server

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StandardNamespaceFilter = dao.NamespaceFilter{
	NotDeleted: true,
}
View Source
var StandardVolumeFilter = dao.VolumeFilter{
	NotDeleted: true,
}

Functions

func AddOwnerLogin

func AddOwnerLogin(ctx context.Context, r *model.Resource, client clients.UserManagerClient) error

func AddUserLogins

func AddUserLogins(ctx context.Context, permissions []model.Permission, client clients.UserManagerClient) error

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.

func NamespaceAddUsage

func NamespaceAddUsage(ctx context.Context, ns *kubeAPIModel.Namespace, client clients.KubeAPIClient) error

func NamespaceVolumeGlusterLabel

func NamespaceVolumeGlusterLabel(nsLabel string) string

func OwnerCheck

func OwnerCheck(ctx context.Context, resource model.Resource) error

func VolumeGlusterName

func VolumeGlusterName(nsLabel, userID string) string

VolumeGlusterName generates volume name for glusterfs (non-persistent volumes)

Types

type AccessActions

type AccessActions interface {
	GetUserAccesses(ctx context.Context) (*authProto.ResourcesAccess, error)
	SetUserAccesses(ctx context.Context, accessLevel kubeClientModel.AccessLevel) error
	GetNamespaceAccess(ctx context.Context, id string) (kubeClientModel.Namespace, error)
	SetNamespaceAccess(ctx context.Context, id, targetUser string, accessLevel kubeClientModel.AccessLevel) error
	GetVolumeAccess(ctx context.Context, id string) (model.VolumeWithPermissions, error)
	SetVolumeAccess(ctx context.Context, id, targetUser string, accessLevel kubeClientModel.AccessLevel) error
	DeleteNamespaceAccess(ctx context.Context, id string, targetUser string) error
	DeleteVolumeAccess(ctx context.Context, id string, targetUser string) error
}

type Clients

func (*Clients) Close

func (c *Clients) Close() error

type NamespaceActions

type NamespaceActions interface {
	CreateNamespace(ctx context.Context, req model.NamespaceCreateRequest) error
	GetNamespace(ctx context.Context, id string) (kubeClientModel.Namespace, error)
	GetUserNamespaces(ctx context.Context, filters ...string) ([]kubeClientModel.Namespace, error)
	GetAllNamespaces(ctx context.Context, page, perPage int, filters ...string) ([]kubeClientModel.Namespace, error)
	AdminCreateNamespace(ctx context.Context, req model.NamespaceAdminCreateRequest) error
	AdminResizeNamespace(ctx context.Context, id string, req model.NamespaceAdminResizeRequest) error
	RenameNamespace(ctx context.Context, id, newLabel string) error
	ResizeNamespace(ctx context.Context, id, newTariffID string) error
	DeleteNamespace(ctx context.Context, id string) error
	DeleteAllUserNamespaces(ctx context.Context) error
}

type Server

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

func NewServer

func NewServer(db *dao.DAO, clients *Clients) *Server

func (*Server) AdminCreateNamespace

func (s *Server) AdminCreateNamespace(ctx context.Context, req model.NamespaceAdminCreateRequest) error

func (*Server) AdminResizeNamespace

func (s *Server) AdminResizeNamespace(ctx context.Context, id string, req model.NamespaceAdminResizeRequest) error

func (*Server) Close

func (s *Server) Close() error

func (*Server) CreateNamespace

func (s *Server) CreateNamespace(ctx context.Context, req model.NamespaceCreateRequest) 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, req model.VolumeCreateRequest) error

func (*Server) DeleteAllUserNamespaces

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

func (*Server) DeleteAllUserVolumes

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

func (*Server) DeleteNamespace

func (s *Server) DeleteNamespace(ctx context.Context, id string) error

func (*Server) DeleteNamespaceAccess

func (s *Server) DeleteNamespaceAccess(ctx context.Context, id string, targetUser string) error

func (*Server) DeleteStorage

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

func (*Server) DeleteVolume

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

func (*Server) DeleteVolumeAccess

func (s *Server) DeleteVolumeAccess(ctx context.Context, id string, targetUser string) error

func (*Server) GetAllNamespaces

func (s *Server) GetAllNamespaces(ctx context.Context, page, perPage int, filters ...string) ([]kubeClientModel.Namespace, error)

func (*Server) GetAllVolumes

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

func (*Server) GetNamespace

func (s *Server) GetNamespace(ctx context.Context, id string) (kubeClientModel.Namespace, error)

func (*Server) GetNamespaceAccess

func (s *Server) GetNamespaceAccess(ctx context.Context, id string) (kubeClientModel.Namespace, error)

func (*Server) GetStorages

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

func (*Server) GetUserAccesses

func (s *Server) GetUserAccesses(ctx context.Context) (*authProto.ResourcesAccess, error)

func (*Server) GetUserNamespaces

func (s *Server) GetUserNamespaces(ctx context.Context, filters ...string) ([]kubeClientModel.Namespace, error)

func (*Server) GetUserVolumes

func (s *Server) GetUserVolumes(ctx context.Context, filters ...string) ([]kubeClientModel.Volume, error)

func (*Server) GetVolume

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

func (*Server) GetVolumeAccess

func (s *Server) GetVolumeAccess(ctx context.Context, id string) (model.VolumeWithPermissions, error)

func (*Server) RenameNamespace

func (s *Server) RenameNamespace(ctx context.Context, id, newLabel string) error

func (*Server) RenameVolume

func (s *Server) RenameVolume(ctx context.Context, id, newLabel string) error

func (*Server) ResizeNamespace

func (s *Server) ResizeNamespace(ctx context.Context, id, newTariffID string) error

func (*Server) ResizeVolume

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

func (*Server) SetNamespaceAccess

func (s *Server) SetNamespaceAccess(ctx context.Context, id, targetUser string, accessLevel kubeClientModel.AccessLevel) error

func (*Server) SetUserAccesses

func (s *Server) SetUserAccesses(ctx context.Context, access kubeClientModel.AccessLevel) error

func (*Server) SetVolumeAccess

func (s *Server) SetVolumeAccess(ctx context.Context, id, targetUser string, accessLevel kubeClientModel.AccessLevel) 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 {
	CreateVolume(ctx context.Context, req model.VolumeCreateRequest) error
	RenameVolume(ctx context.Context, id, newLabel string) error
	ResizeVolume(ctx context.Context, id string, newTariffID string) error
	GetVolume(ctx context.Context, id string) (kubeClientModel.Volume, error)
	GetUserVolumes(ctx context.Context, filters ...string) ([]kubeClientModel.Volume, error)
	GetAllVolumes(ctx context.Context, page, perPage int, filters ...string) ([]kubeClientModel.Volume, error)
	DeleteVolume(ctx context.Context, id 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