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 ¶
- type BackupSchedule
- type Client
- type Component
- type ConfigService
- type Configuration
- type Dogu
- type DoguConfig
- type DoguExport
- type DoguVolume
- type ExportDoguClient
- type ExportMode
- type ExportModeClient
- type GlobalConfig
- type HTTPClientOption
- type KeyValue
- type MaintenanceMode
- type MaintenanceModeService
- type MaintenanceModeStatus
- type Message
- type Service
- type SystemInfo
- type SystemInfoClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
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 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) (*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 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 ExportDoguClient ¶
type ExportDoguClient struct {
// contains filtered or unexported fields
}
func NewExportDoguClient ¶
func NewExportDoguClient(apiClient apiClient) *ExportDoguClient
func (*ExportDoguClient) GetExportDogu ¶
func (emc *ExportDoguClient) GetExportDogu(ctx context.Context) (export *DoguExport, err error)
func (*ExportDoguClient) SetExportDogu ¶
func (emc *ExportDoguClient) SetExportDogu(ctx context.Context, doguName string) (export *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 ExportModeClient ¶
type ExportModeClient struct {
// contains filtered or unexported fields
}
func NewExportModeClient ¶
func NewExportModeClient(apiClient apiClient) *ExportModeClient
func (*ExportModeClient) GetExportMode ¶
func (emc *ExportModeClient) GetExportMode(ctx context.Context) (isActive bool, err error)
type GlobalConfig ¶
type GlobalConfig []KeyValue
GlobalConfig contains the global configuration of the exporter system.
type HTTPClientOption ¶
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 ¶
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 ¶
func (s MaintenanceModeService) Enable(ctx context.Context, title, message string) error
Enable 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.
type MaintenanceModeStatus ¶
type MaintenanceModeStatus struct {
IsActive bool `json:"isActive"`
}
MaintenanceModeStatus returns just the current state of the maintenance mode on exporter side
type Service ¶
type Service struct {
*MaintenanceModeService
*ConfigService
}
func NewService ¶
func NewService(client apiClient) *Service
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 SystemInfoClient ¶
type SystemInfoClient struct {
// contains filtered or unexported fields
}
func NewSystemInfoClient ¶
func NewSystemInfoClient(apiClient apiClient) *SystemInfoClient
func (*SystemInfoClient) GetSystemInfo ¶
func (emc *SystemInfoClient) GetSystemInfo(ctx context.Context) (systemInfo *SystemInfo, err error)