handlers

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package handlers contains the interface and types for the Everest API handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupStorageHandler

type BackupStorageHandler interface {
	CreateBackupStorage(ctx context.Context, namespace string, req *api.CreateBackupStorageParams) (*everestv1alpha1.BackupStorage, error)
	UpdateBackupStorage(ctx context.Context, name, namespace string, req *api.UpdateBackupStorageParams) (*everestv1alpha1.BackupStorage, error)
	ListBackupStorages(ctx context.Context, namespace string) (*everestv1alpha1.BackupStorageList, error)
	GetBackupStorage(ctx context.Context, namespace, name string) (*everestv1alpha1.BackupStorage, error)
	DeleteBackupStorage(ctx context.Context, namespace, name string) error
}

BackupStorageHandler provides methods for handling operations on backup storages.

type DatabaseClusterBackupHandler

type DatabaseClusterBackupHandler interface {
	GetDatabaseClusterBackup(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterBackup, error)
	ListDatabaseClusterBackups(ctx context.Context, namespace, clusterName string) (*everestv1alpha1.DatabaseClusterBackupList, error)
	CreateDatabaseClusterBackup(ctx context.Context, req *everestv1alpha1.DatabaseClusterBackup) (*everestv1alpha1.DatabaseClusterBackup, error)
	DeleteDatabaseClusterBackup(ctx context.Context, namespace, name string, req *api.DeleteDatabaseClusterBackupParams) error
}

DatabaseClusterBackupHandler provides methods for handling operations on database cluster backups.

type DatabaseClusterHandler

type DatabaseClusterHandler interface {
	CreateDatabaseCluster(ctx context.Context, req *everestv1alpha1.DatabaseCluster) (*everestv1alpha1.DatabaseCluster, error)
	UpdateDatabaseCluster(ctx context.Context, req *everestv1alpha1.DatabaseCluster) (*everestv1alpha1.DatabaseCluster, error)
	ListDatabaseClusters(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseClusterList, error)
	DeleteDatabaseCluster(ctx context.Context, namespace, name string, delReq *api.DeleteDatabaseClusterParams) error
	GetDatabaseCluster(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseCluster, error)
	GetDatabaseClusterCredentials(ctx context.Context, namespace, name string) (*api.DatabaseClusterCredential, error)
	GetDatabaseClusterComponents(ctx context.Context, namespace, name string) ([]api.DatabaseClusterComponent, error)
	GetDatabaseClusterPitr(ctx context.Context, namespace, name string) (*api.DatabaseClusterPitr, error)
}

DatabaseClusterHandler provides methods for handling operations on database clusters.

type DatabaseClusterRestoreHandler

type DatabaseClusterRestoreHandler interface {
	CreateDatabaseClusterRestore(ctx context.Context, req *everestv1alpha1.DatabaseClusterRestore) (*everestv1alpha1.DatabaseClusterRestore, error)
	UpdateDatabaseClusterRestore(ctx context.Context, req *everestv1alpha1.DatabaseClusterRestore) (*everestv1alpha1.DatabaseClusterRestore, error)
	GetDatabaseClusterRestore(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseClusterRestore, error)
	ListDatabaseClusterRestores(ctx context.Context, namespace, clusterName string) (*everestv1alpha1.DatabaseClusterRestoreList, error)
	DeleteDatabaseClusterRestore(ctx context.Context, namespace, name string) error
}

DatabaseClusterRestoreHandler provides methods for handling operations on database cluster restores.

type DatabaseEngineHandler

type DatabaseEngineHandler interface {
	UpdateDatabaseEngine(ctx context.Context, req *everestv1alpha1.DatabaseEngine) (*everestv1alpha1.DatabaseEngine, error)
	ListDatabaseEngines(ctx context.Context, namespace string) (*everestv1alpha1.DatabaseEngineList, error)
	GetDatabaseEngine(ctx context.Context, namespace, name string) (*everestv1alpha1.DatabaseEngine, error)
	GetUpgradePlan(ctx context.Context, namespace string) (*api.UpgradePlan, error)
	ApproveUpgradePlan(ctx context.Context, namespace string) error
}

DatabaseEngineHandler provides methods for handling operations on database engines.

type Handler

type Handler interface {
	// SetNext sets the next handler to call in the chain.
	SetNext(h Handler)

	NamespacesHandler
	DatabaseClusterHandler
	DatabaseClusterBackupHandler
	DatabaseClusterRestoreHandler
	DatabaseEngineHandler
	BackupStorageHandler
	MonitoringInstanceHandler
	PodSchedulingPolicyHandler

	GetKubernetesClusterResources(ctx context.Context) (*api.KubernetesClusterResources, error)
	GetKubernetesClusterInfo(ctx context.Context) (*api.KubernetesClusterInfo, error)
	GetUserPermissions(ctx context.Context) (*api.UserPermissions, error)
	GetSettings(ctx context.Context) (*api.Settings, error)
}

Handler provides an abstraction for the core business logic of the Everest API. Each implementation of a handler is responsible for handling a specific set of operations (e.g, request validation, RBAC, KubeAPI, etc.). Handlers may be chained together using the SetNext() method to form a chain of responsibility. Each Handler implementation is individually responsible for calling the next handler in the chain.

type MockHandler

type MockHandler struct {
	mock.Mock
}

MockHandler is an autogenerated mock type for the Handler type

func NewMockHandler

func NewMockHandler(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockHandler

NewMockHandler creates a new instance of MockHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockHandler) ApproveUpgradePlan

func (_m *MockHandler) ApproveUpgradePlan(ctx context.Context, namespace string) error

ApproveUpgradePlan provides a mock function with given fields: ctx, namespace

func (*MockHandler) CreateBackupStorage

func (_m *MockHandler) CreateBackupStorage(ctx context.Context, namespace string, req *api.CreateBackupStorageParams) (*v1alpha1.BackupStorage, error)

CreateBackupStorage provides a mock function with given fields: ctx, namespace, req

func (*MockHandler) CreateDatabaseCluster

func (_m *MockHandler) CreateDatabaseCluster(ctx context.Context, req *v1alpha1.DatabaseCluster) (*v1alpha1.DatabaseCluster, error)

CreateDatabaseCluster provides a mock function with given fields: ctx, req

func (*MockHandler) CreateDatabaseClusterBackup

func (_m *MockHandler) CreateDatabaseClusterBackup(ctx context.Context, req *v1alpha1.DatabaseClusterBackup) (*v1alpha1.DatabaseClusterBackup, error)

CreateDatabaseClusterBackup provides a mock function with given fields: ctx, req

func (*MockHandler) CreateDatabaseClusterRestore

func (_m *MockHandler) CreateDatabaseClusterRestore(ctx context.Context, req *v1alpha1.DatabaseClusterRestore) (*v1alpha1.DatabaseClusterRestore, error)

CreateDatabaseClusterRestore provides a mock function with given fields: ctx, req

func (*MockHandler) CreateMonitoringInstance

func (_m *MockHandler) CreateMonitoringInstance(ctx context.Context, namespace string, req *api.MonitoringInstanceCreateParams) (*v1alpha1.MonitoringConfig, error)

CreateMonitoringInstance provides a mock function with given fields: ctx, namespace, req

func (*MockHandler) CreatePodSchedulingPolicy added in v1.7.0

func (_m *MockHandler) CreatePodSchedulingPolicy(ctx context.Context, psp *v1alpha1.PodSchedulingPolicy) (*v1alpha1.PodSchedulingPolicy, error)

CreatePodSchedulingPolicy provides a mock function with given fields: ctx, psp

func (*MockHandler) DeleteBackupStorage

func (_m *MockHandler) DeleteBackupStorage(ctx context.Context, namespace string, name string) error

DeleteBackupStorage provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) DeleteDatabaseCluster

func (_m *MockHandler) DeleteDatabaseCluster(ctx context.Context, namespace string, name string, delReq *api.DeleteDatabaseClusterParams) error

DeleteDatabaseCluster provides a mock function with given fields: ctx, namespace, name, delReq

func (*MockHandler) DeleteDatabaseClusterBackup

func (_m *MockHandler) DeleteDatabaseClusterBackup(ctx context.Context, namespace string, name string, req *api.DeleteDatabaseClusterBackupParams) error

DeleteDatabaseClusterBackup provides a mock function with given fields: ctx, namespace, name, req

func (*MockHandler) DeleteDatabaseClusterRestore

func (_m *MockHandler) DeleteDatabaseClusterRestore(ctx context.Context, namespace string, name string) error

DeleteDatabaseClusterRestore provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) DeleteMonitoringInstance

func (_m *MockHandler) DeleteMonitoringInstance(ctx context.Context, namespace string, name string) error

DeleteMonitoringInstance provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) DeletePodSchedulingPolicy added in v1.7.0

func (_m *MockHandler) DeletePodSchedulingPolicy(ctx context.Context, name string) error

DeletePodSchedulingPolicy provides a mock function with given fields: ctx, name

func (*MockHandler) GetBackupStorage

func (_m *MockHandler) GetBackupStorage(ctx context.Context, namespace string, name string) (*v1alpha1.BackupStorage, error)

GetBackupStorage provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseCluster

func (_m *MockHandler) GetDatabaseCluster(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseCluster, error)

GetDatabaseCluster provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseClusterBackup

func (_m *MockHandler) GetDatabaseClusterBackup(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseClusterBackup, error)

GetDatabaseClusterBackup provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseClusterComponents

func (_m *MockHandler) GetDatabaseClusterComponents(ctx context.Context, namespace string, name string) ([]api.DatabaseClusterComponent, error)

GetDatabaseClusterComponents provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseClusterCredentials

func (_m *MockHandler) GetDatabaseClusterCredentials(ctx context.Context, namespace string, name string) (*api.DatabaseClusterCredential, error)

GetDatabaseClusterCredentials provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseClusterPitr

func (_m *MockHandler) GetDatabaseClusterPitr(ctx context.Context, namespace string, name string) (*api.DatabaseClusterPitr, error)

GetDatabaseClusterPitr provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseClusterRestore

func (_m *MockHandler) GetDatabaseClusterRestore(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseClusterRestore, error)

GetDatabaseClusterRestore provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetDatabaseEngine

func (_m *MockHandler) GetDatabaseEngine(ctx context.Context, namespace string, name string) (*v1alpha1.DatabaseEngine, error)

GetDatabaseEngine provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetKubernetesClusterInfo

func (_m *MockHandler) GetKubernetesClusterInfo(ctx context.Context) (*api.KubernetesClusterInfo, error)

GetKubernetesClusterInfo provides a mock function with given fields: ctx

func (*MockHandler) GetKubernetesClusterResources

func (_m *MockHandler) GetKubernetesClusterResources(ctx context.Context) (*api.KubernetesClusterResources, error)

GetKubernetesClusterResources provides a mock function with given fields: ctx

func (*MockHandler) GetMonitoringInstance

func (_m *MockHandler) GetMonitoringInstance(ctx context.Context, namespace string, name string) (*v1alpha1.MonitoringConfig, error)

GetMonitoringInstance provides a mock function with given fields: ctx, namespace, name

func (*MockHandler) GetPodSchedulingPolicy added in v1.7.0

func (_m *MockHandler) GetPodSchedulingPolicy(ctx context.Context, name string) (*v1alpha1.PodSchedulingPolicy, error)

GetPodSchedulingPolicy provides a mock function with given fields: ctx, name

func (*MockHandler) GetSettings

func (_m *MockHandler) GetSettings(ctx context.Context) (*api.Settings, error)

GetSettings provides a mock function with given fields: ctx

func (*MockHandler) GetUpgradePlan

func (_m *MockHandler) GetUpgradePlan(ctx context.Context, namespace string) (*api.UpgradePlan, error)

GetUpgradePlan provides a mock function with given fields: ctx, namespace

func (*MockHandler) GetUserPermissions

func (_m *MockHandler) GetUserPermissions(ctx context.Context) (*api.UserPermissions, error)

GetUserPermissions provides a mock function with given fields: ctx

func (*MockHandler) ListBackupStorages

func (_m *MockHandler) ListBackupStorages(ctx context.Context, namespace string) (*v1alpha1.BackupStorageList, error)

ListBackupStorages provides a mock function with given fields: ctx, namespace

func (*MockHandler) ListDatabaseClusterBackups

func (_m *MockHandler) ListDatabaseClusterBackups(ctx context.Context, namespace string, clusterName string) (*v1alpha1.DatabaseClusterBackupList, error)

ListDatabaseClusterBackups provides a mock function with given fields: ctx, namespace, clusterName

func (*MockHandler) ListDatabaseClusterRestores

func (_m *MockHandler) ListDatabaseClusterRestores(ctx context.Context, namespace string, clusterName string) (*v1alpha1.DatabaseClusterRestoreList, error)

ListDatabaseClusterRestores provides a mock function with given fields: ctx, namespace, clusterName

func (*MockHandler) ListDatabaseClusters

func (_m *MockHandler) ListDatabaseClusters(ctx context.Context, namespace string) (*v1alpha1.DatabaseClusterList, error)

ListDatabaseClusters provides a mock function with given fields: ctx, namespace

func (*MockHandler) ListDatabaseEngines

func (_m *MockHandler) ListDatabaseEngines(ctx context.Context, namespace string) (*v1alpha1.DatabaseEngineList, error)

ListDatabaseEngines provides a mock function with given fields: ctx, namespace

func (*MockHandler) ListMonitoringInstances

func (_m *MockHandler) ListMonitoringInstances(ctx context.Context, namespaces string) (*v1alpha1.MonitoringConfigList, error)

ListMonitoringInstances provides a mock function with given fields: ctx, namespaces

func (*MockHandler) ListNamespaces

func (_m *MockHandler) ListNamespaces(ctx context.Context) ([]string, error)

ListNamespaces provides a mock function with given fields: ctx

func (*MockHandler) ListPodSchedulingPolicies added in v1.7.0

func (_m *MockHandler) ListPodSchedulingPolicies(ctx context.Context, params *api.ListPodSchedulingPolicyParams) (*v1alpha1.PodSchedulingPolicyList, error)

ListPodSchedulingPolicies provides a mock function with given fields: ctx, params

func (*MockHandler) SetNext

func (_m *MockHandler) SetNext(h Handler)

SetNext provides a mock function with given fields: h

func (*MockHandler) UpdateBackupStorage

func (_m *MockHandler) UpdateBackupStorage(ctx context.Context, name string, namespace string, req *api.UpdateBackupStorageParams) (*v1alpha1.BackupStorage, error)

UpdateBackupStorage provides a mock function with given fields: ctx, name, namespace, req

func (*MockHandler) UpdateDatabaseCluster

func (_m *MockHandler) UpdateDatabaseCluster(ctx context.Context, req *v1alpha1.DatabaseCluster) (*v1alpha1.DatabaseCluster, error)

UpdateDatabaseCluster provides a mock function with given fields: ctx, req

func (*MockHandler) UpdateDatabaseClusterRestore

func (_m *MockHandler) UpdateDatabaseClusterRestore(ctx context.Context, req *v1alpha1.DatabaseClusterRestore) (*v1alpha1.DatabaseClusterRestore, error)

UpdateDatabaseClusterRestore provides a mock function with given fields: ctx, req

func (*MockHandler) UpdateDatabaseEngine

func (_m *MockHandler) UpdateDatabaseEngine(ctx context.Context, req *v1alpha1.DatabaseEngine) (*v1alpha1.DatabaseEngine, error)

UpdateDatabaseEngine provides a mock function with given fields: ctx, req

func (*MockHandler) UpdateMonitoringInstance

func (_m *MockHandler) UpdateMonitoringInstance(ctx context.Context, namespace string, name string, req *api.MonitoringInstanceUpdateParams) (*v1alpha1.MonitoringConfig, error)

UpdateMonitoringInstance provides a mock function with given fields: ctx, namespace, name, req

func (*MockHandler) UpdatePodSchedulingPolicy added in v1.7.0

func (_m *MockHandler) UpdatePodSchedulingPolicy(ctx context.Context, psp *v1alpha1.PodSchedulingPolicy) (*v1alpha1.PodSchedulingPolicy, error)

UpdatePodSchedulingPolicy provides a mock function with given fields: ctx, psp

type MonitoringInstanceHandler

type MonitoringInstanceHandler interface {
	CreateMonitoringInstance(ctx context.Context, namespace string, req *api.CreateMonitoringInstanceJSONRequestBody) (*everestv1alpha1.MonitoringConfig, error)
	UpdateMonitoringInstance(ctx context.Context, namespace, name string, req *api.UpdateMonitoringInstanceJSONRequestBody) (*everestv1alpha1.MonitoringConfig, error)
	ListMonitoringInstances(ctx context.Context, namespaces string) (*everestv1alpha1.MonitoringConfigList, error)
	GetMonitoringInstance(ctx context.Context, namespace, name string) (*everestv1alpha1.MonitoringConfig, error)
	DeleteMonitoringInstance(ctx context.Context, namespace, name string) error
}

MonitoringInstanceHandler provides methods for handling operations on monitoring instances.

type NamespacesHandler

type NamespacesHandler interface {
	ListNamespaces(ctx context.Context) ([]string, error)
}

NamespacesHandler provides methods for handling operations on namespaces.

type PodSchedulingPolicyHandler added in v1.7.0

type PodSchedulingPolicyHandler interface {
	CreatePodSchedulingPolicy(ctx context.Context, psp *everestv1alpha1.PodSchedulingPolicy) (*everestv1alpha1.PodSchedulingPolicy, error)
	UpdatePodSchedulingPolicy(ctx context.Context, psp *everestv1alpha1.PodSchedulingPolicy) (*everestv1alpha1.PodSchedulingPolicy, error)
	ListPodSchedulingPolicies(ctx context.Context, params *api.ListPodSchedulingPolicyParams) (*everestv1alpha1.PodSchedulingPolicyList, error)
	DeletePodSchedulingPolicy(ctx context.Context, name string) error
	GetPodSchedulingPolicy(ctx context.Context, name string) (*everestv1alpha1.PodSchedulingPolicy, error)
}

PodSchedulingPolicyHandler provides methods for handling operations on pod scheduling policies.

Directories

Path Synopsis
Package k8s contains the Kubernetes handler.
Package k8s contains the Kubernetes handler.
Package rbac provides the RBAC handler.
Package rbac provides the RBAC handler.
Package validation provides the validation handler.
Package validation provides the validation handler.

Jump to

Keyboard shortcuts

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