integration

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 5 Imported by: 8

Documentation

Overview

Package integration exposes the requirements that an integration must meet to be compatible with the helix.go ecosystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigTLS

type ConfigTLS struct {

	// Enabled enables TLS for the integration. When disabled, other fields are
	// ignored and can be empty.
	Enabled bool `json:"enabled"`

	// ServerName is used to verify the hostname on the returned certificates. It
	// is also included in the client's handshake to support virtual hosting unless
	// it is an IP address.
	ServerName string `json:"server_name,omitempty"`

	// InsecureSkipVerify controls whether a client verifies the server's certificate
	// chain and host name. If InsecureSkipVerify is true, crypto/tls accepts any
	// certificate presented by the server and any host name in that certificate.
	// In this mode, TLS is susceptible to machine-in-the-middle attacks unless
	// custom verification is used.
	InsecureSkipVerify bool `json:"insecure_skip_verify"`

	// CertFile is the relative or absolute path to the certificate file.
	//
	// Example:
	//
	//   "./server.crt"
	CertFile string `json:"-"`

	// KeyFile is the relative or absolute path to the private key file.
	//
	// Example:
	//
	//   "./server.key"
	KeyFile string `json:"-"`

	// RootCAFiles allows to provide the RootCAs pool from a list of filenames.
	// This is not required by all integrations.
	RootCAFiles []string `json:"-"`
}

ConfigTLS is the common configuration for TLS across all integrations.

func (*ConfigTLS) Sanitize

func (cfg *ConfigTLS) Sanitize() []errorstack.Validation

Sanitize sets default values - if applicable - and validates the configuration. Returns validation errors if configuration is not valid. This doesn't return a standard error since this function shall only be called by integrations. This allows to easily add error validations to an existing errorstack:

stack.WithValidations(cfg.TLS.Sanitize()...)

func (*ConfigTLS) ToStandardTLS

func (cfg *ConfigTLS) ToStandardTLS() (*tls.Config, []errorstack.Validation)

ToStandardTLS tries to return a Go standard *tls.Config. Returns validation errors if configuration is not valid. This doesn't return a standard error since this function shall only be called by integrations. This allows to easily add error validations to an existing errorstack.

type Integration

type Integration interface {

	// String returns the string representation of the integration.
	//
	// Examples:
	//
	//   "nats"
	//   "vault"
	String() string

	// Start starts/opens a connection with the integration, if applicable. This
	// function can be blocking, for starting a server or a worker for example.
	// The service package executes each Start function of attached integrations
	// in their own goroutine, and returns an error as soon as a goroutine returns
	// a non-nil error.
	Start(ctx context.Context) error

	// Close closes the connection with the integration, if applicable.
	Close(ctx context.Context) error

	// Status executes a health check of the integration. It returns an equivalent
	// HTTP status code of the health. It should most likely be `200` or `503`.
	// If the integration is unhealthy, it may return an error as well depending
	// on the underlying client.
	Status(ctx context.Context) (int, error)
}

Integration describes the lifecycle of an integration.

Directories

Path Synopsis
bucket module
clickhouse module
nats module
openfeature module
postgres module
rest module
temporal module
vault module

Jump to

Keyboard shortcuts

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