server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZeroUUID = "00000000-0000-0000-0000-000000000000"
)

Variables

View Source
var StandardVolumeFilter = database.VolumeFilter{
	NotDeleted: true,
}

Functions

func CheckTariff

func CheckTariff(tariff billing.Tariff, isAdmin bool) error

CheckTariff checks if user has permissions to use tariff

func IsAdminRole

func IsAdminRole(ctx context.Context) bool

IsAdminRole checks that request came from user with admin permissions.

Types

type Clients

type Clients struct {
	Billing clients.BillingClient
	KubeAPI clients.KubeAPIClient
}

func (*Clients) Close

func (c *Clients) Close() error

type Server

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

func NewServer

func NewServer(db database.DB, clients *Clients) *Server

func (*Server) AdminResizeVolume

func (s *Server) AdminResizeVolume(ctx context.Context, nsID, label string, newCapacity int) error

func (*Server) CreateStorage

func (s *Server) CreateStorage(ctx context.Context, storage model.Storage) error

func (*Server) CreateVolume

func (s *Server) CreateVolume(ctx context.Context, nsID string, req model.VolumeCreateRequest) error

func (*Server) DeleteAllNamespaceVolumes

func (s *Server) DeleteAllNamespaceVolumes(ctx context.Context, nsID string) error

func (*Server) DeleteAllUserVolumes

func (s *Server) DeleteAllUserVolumes(ctx context.Context) error

func (*Server) DeleteStorage

func (s *Server) DeleteStorage(ctx context.Context, name string) error

func (*Server) DeleteVolume

func (s *Server) DeleteVolume(ctx context.Context, nsID, label string) error

func (*Server) DirectCreateVolume

func (s *Server) DirectCreateVolume(ctx context.Context, nsID string, req model.DirectVolumeCreateRequest) error

func (*Server) GetAllVolumes

func (s *Server) GetAllVolumes(ctx context.Context, page, perPage int, filters ...string) (kubeClientModel.VolumesList, error)

func (*Server) GetNamespaceVolumes

func (s *Server) GetNamespaceVolumes(ctx context.Context, nsID string) (kubeClientModel.VolumesList, error)

func (*Server) GetStorages

func (s *Server) GetStorages(ctx context.Context) ([]model.Storage, error)

func (*Server) GetUserVolumes

func (s *Server) GetUserVolumes(ctx context.Context) (kubeClientModel.VolumesList, error)

func (*Server) GetVolume

func (s *Server) GetVolume(ctx context.Context, nsID, label string) (kubeClientModel.Volume, error)

func (*Server) ImportVolume

func (s *Server) ImportVolume(ctx context.Context, nsID string, req kubeClientModel.Volume) error

func (*Server) ResizeVolume

func (s *Server) ResizeVolume(ctx context.Context, nsID, label string, newTariffID string) error

func (*Server) UpdateStorage

func (s *Server) UpdateStorage(ctx context.Context, name string, req model.UpdateStorageRequest) error

type StorageActions

type StorageActions interface {
	CreateStorage(ctx context.Context, storage model.Storage) error
	GetStorages(ctx context.Context) ([]model.Storage, error)
	UpdateStorage(ctx context.Context, name string, req model.UpdateStorageRequest) error
	DeleteStorage(ctx context.Context, name string) error
}

type VolumeActions

type VolumeActions interface {
	DirectCreateVolume(ctx context.Context, nsID string, req model.DirectVolumeCreateRequest) error
	CreateVolume(ctx context.Context, nsID string, req model.VolumeCreateRequest) error
	ImportVolume(ctx context.Context, nsID string, req kubeClientModel.Volume) error
	AdminResizeVolume(ctx context.Context, nsID, label string, newCapacity int) error
	ResizeVolume(ctx context.Context, nsID, label string, newTariffID string) error
	GetVolume(ctx context.Context, nsID, label string) (kubeClientModel.Volume, error)
	GetUserVolumes(ctx context.Context) (kubeClientModel.VolumesList, error)
	GetNamespaceVolumes(ctx context.Context, nsID string) (kubeClientModel.VolumesList, error)
	GetAllVolumes(ctx context.Context, page, perPage int, filters ...string) (kubeClientModel.VolumesList, error)
	DeleteVolume(ctx context.Context, nsID, label string) error
	DeleteAllNamespaceVolumes(ctx context.Context, nsID string) error
	DeleteAllUserVolumes(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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