exporter

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package exporter contains code that deals with exporter API calls. It also provides business level structs into that HTTP responses can be parsed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHost added in v0.0.3

type APIHost string

type APIKey added in v0.0.3

type APIKey string

type BackupSchedule

type BackupSchedule struct {
	// Name of the backup schedule.
	Name string `json:"name"`
	// Schedule is defined as a cron expression.
	Schedule string `json:"schedule"`
}

BackupSchedule contains the configuration of a single backup schedule.

type Client

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

func NewClient

func NewClient(hostName string, apiKey string, options ...HTTPClientOption) *Client

NewClient creates a Client for easy API access with the given HTTP Client. This allows for generically modifying the HTTP Client f. i. adding proxy settings.

func (*Client) DoGetRequest

func (c *Client) DoGetRequest(ctx context.Context, path string) (result []byte, err error)

DoGetRequest creates an HTTP GET request towards the exporter API. Any unexpected HTTP codes (other than 200 OK) or errors will be returned as an error. For authentication, request headers will automatically be enriched with the provided API key.

func (*Client) DoPostRequest

func (c *Client) DoPostRequest(ctx context.Context, path string, body io.Reader) (result []byte, err error)

DoPostRequest creates an HTTP POST request towards the exporter API. Path params will be appended to the given url. Any unexpected HTTP codes (other than 200 OK) or errors will be returned as an error. For authentication, request headers will automatically be enriched with the provided API key.

type Component

type Component struct {
	// Name holds the component name.
	Name string `json:"name"`
	// Version holds the component version.
	Version string `json:"version"`
}

type ConfigService

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

ConfigService is a client for the exporter configuration API.

func NewConfigService

func NewConfigService(apiClient apiClient) *ConfigService

NewConfigService creates a new ConfigService.

func (*ConfigService) GetConfig

func (cs *ConfigService) GetConfig(ctx context.Context) (*migration.Configuration, error)

GetConfig returns the configuration of the exporter system.

type Configuration

type Configuration struct {
	// GlobalConfig is the global configuration of the exporter system.
	GlobalConfig GlobalConfig `json:"global"`
	// DoguConfigs is the configuration of all installed dogus in the exporter system.
	DoguConfigs []DoguConfig `json:"dogus"`
	// BackupSchedules is the configuration of all backup schedules in the exporter system.
	BackupSchedules []BackupSchedule `json:"backupSchedules"`
}

Configuration contains the configuration of the exporter system.

type Dogu

type Dogu struct {
	// Name holds the dogu name including the namespace delimited by a slash ("/").
	Name string `json:"name"`
	// Version holds the dogu version.
	Version string `json:"version"`
	// Volume contains data on the dogu's persistent storage.
	Volume DoguVolume `json:"volume"`
}

Dogu contains data on a single installed dogu on the exporter side.

type DoguConfig

type DoguConfig struct {
	// Name of the dogu.
	Name string `json:"name"`
	// NormalConfig normal dogu configuration as KeyValue pairs
	NormalConfig []KeyValue `json:"normal"`
	// LocalConfig local dogu configuration as KeyValue pairs
	LocalConfig []KeyValue `json:"local"`
	// SensitiveConfig sensitive dogu configuration as KeyValue pairs
	SensitiveConfig []KeyValue `json:"sensitive"`
}

DoguConfig contains the configuration of a single dogu.

type DoguExport

type DoguExport struct {
	Dogu         string `json:"dogu"`
	VolumePath   string `json:"volumePath"`
	ExporterPort int    `json:"exporterPort"`
}

type DoguVolume

type DoguVolume struct {
	// SizeInBytes contains the expected dogu volume size.
	//
	// While int32 (~2 Gibi bytes) is too small for comfort, int64 (~9 Exbi bytes) should suffice to accommodate the
	// size of even the largest dogu volume.
	SizeInBytes int64 `json:"sizeInBytes"`
}

DoguVolume contains data on the dogu's persistent storage.

type ExportDoguService added in v0.0.3

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

func NewExportDoguService added in v0.0.3

func NewExportDoguService(apiClient apiClient) *ExportDoguService

func (*ExportDoguService) GetExportDogu added in v0.0.3

func (emc *ExportDoguService) GetExportDogu(ctx context.Context) (export *migration.DoguExport, err error)

func (*ExportDoguService) SetExportDogu added in v0.0.3

func (emc *ExportDoguService) SetExportDogu(ctx context.Context, doguName string) (export *migration.DoguExport, err error)

type ExportMode

type ExportMode struct {
	// IsActive indicates whether the exporter system is ready to conduct an export (true) or not (false).
	IsActive bool `json:"isActive"`
}

ExportMode contains data about the export readiness of the exporter system.

type ExportModeService added in v0.0.3

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

func NewExportModeService added in v0.0.3

func NewExportModeService(apiClient apiClient) *ExportModeService

func (*ExportModeService) GetExportMode added in v0.0.3

func (emc *ExportModeService) GetExportMode(ctx context.Context) (isActive bool, err error)

type GlobalConfig

type GlobalConfig []KeyValue

GlobalConfig contains the global configuration of the exporter system.

type HTTPClientOption

type HTTPClientOption func(*http.Client)

func WithCustomHTTPClient

func WithCustomHTTPClient(httpClient *http.Client) HTTPClientOption

WithCustomHTTPClient sets a custom HTTP Client to be used when executing requests.

func WithInsecure

func WithInsecure() HTTPClientOption

WithInsecure configures the HTTP Client to skip TLS certificate verification, enabling insecure connections. A valid Client needs to be provided for this option. Either by using the default Client or by creating a custom Client with the WithCustomHTTPClient option.

type KeyValue

type KeyValue struct {
	// Key is the name of the configuration value.
	Key string `json:"key"`
	// Value is the value of the configuration value.
	Value string `json:"value"`
}

KeyValue contains a key-value pair. This is used to represent configuration values.

type MaintenanceMode

type MaintenanceMode struct {
	Activate bool    `json:"activate"`
	Message  Message `json:"message"`
}

MaintenanceMode contains data of the current maintenance state

type MaintenanceModeService

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

func NewMaintenanceModeService

func NewMaintenanceModeService(client apiClient) *MaintenanceModeService

NewMaintenanceModeService creates a new maintenance service for the given exporter API client.

func (*MaintenanceModeService) Disable

func (s *MaintenanceModeService) Disable(ctx context.Context) error

Disable disables the maintenance mode of the exporter system.

func (*MaintenanceModeService) Enable

Enable enables the maintenance mode of the exporter with the message previously set.

func (*MaintenanceModeService) EnableWithMessage added in v0.0.3

func (s *MaintenanceModeService) EnableWithMessage(ctx context.Context, title, message string) error

EnableWithMessage enables the maintenance mode of the exporter system with the given title and message.

func (*MaintenanceModeService) GetMaintenanceModeStatus

func (s *MaintenanceModeService) GetMaintenanceModeStatus(ctx context.Context) (bool, error)

GetMaintenanceModeStatus returns the current maintenance mode status of the exporter system. Returns true if the exporter system is in maintenance mode, false otherwise.

func (*MaintenanceModeService) SetMessage added in v0.0.3

func (s *MaintenanceModeService) SetMessage(title, message string)

SetMessage sets the message used for the Enable function.

type MaintenanceModeStatus

type MaintenanceModeStatus struct {
	IsActive bool `json:"isActive"`
}

MaintenanceModeStatus returns just the current state of the maintenance mode on exporter side

type Message

type Message struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

Message contains the title and text of the maintenance message

type Service

func NewService

func NewService(client apiClient) *Service

func NewServiceFromConfig added in v0.0.3

func NewServiceFromConfig(host APIHost, key APIKey, skipTLSVerification SkipTLSVerification) *Service

type SkipTLSVerification added in v0.0.3

type SkipTLSVerification bool

type SystemInfo

type SystemInfo struct {
	// FQDN contains the DNS name of the exporter systeḿ.
	FQDN string `json:"fqdn"`
	// IsMultinode indicates whether the exporter system is a classic CES or a multinode CES instance.
	IsMultinode bool `json:"isMultinode"`
	// Dogus contains data on all installed dogus on the exporter side.
	Dogus []Dogu `json:"dogus"`
	// Components contain data on all installed components on the exporter side.
	Components []Component `json:"components"`
}

SystemInfo contains data on vital data on the exporter side.

type SystemInfoService added in v0.0.3

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

func NewSystemInfoService added in v0.0.3

func NewSystemInfoService(apiClient apiClient) *SystemInfoService

func (*SystemInfoService) GetSystemInfo added in v0.0.3

func (emc *SystemInfoService) GetSystemInfo(ctx context.Context) (*migration.SystemInfo, error)

Jump to

Keyboard shortcuts

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