user

package
v0.0.0-...-c8e7285 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package user is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStopUserTools   = errors.New("cannot stop uninitialized user tools")
	ErrUserToolsActive = errors.New("it is not possible to regenerate SSH keys with the usertools active")
)

Functions

This section is empty.

Types

type MockRepository

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

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) Create

func (m *MockRepository) Create(ctx context.Context, user entity.User) (string, error)

Create mocks base method.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) EnsureIndexes

func (m *MockRepository) EnsureIndexes() error

EnsureIndexes mocks base method.

func (*MockRepository) FindAll

func (m *MockRepository) FindAll(ctx context.Context, includeDeleted bool) ([]entity.User, error)

FindAll mocks base method.

func (*MockRepository) FindByIDs

func (m *MockRepository) FindByIDs(ctx context.Context, userIDs []string) ([]entity.User, error)

FindByIDs mocks base method.

func (*MockRepository) Get

func (m *MockRepository) Get(ctx context.Context, id string) (entity.User, error)

Get mocks base method.

func (*MockRepository) GetByEmail

func (m *MockRepository) GetByEmail(ctx context.Context, email string) (entity.User, error)

GetByEmail mocks base method.

func (*MockRepository) GetByUsername

func (m *MockRepository) GetByUsername(ctx context.Context, username string) (entity.User, error)

GetByUsername mocks base method.

func (*MockRepository) UpdateAccessLevel

func (m *MockRepository) UpdateAccessLevel(ctx context.Context, userIDs []string, level entity.AccessLevel) error

UpdateAccessLevel mocks base method.

func (*MockRepository) UpdateDeleted

func (m *MockRepository) UpdateDeleted(ctx context.Context, userID string, deleted bool) error

UpdateDeleted mocks base method.

func (*MockRepository) UpdateEmail

func (m *MockRepository) UpdateEmail(ctx context.Context, userID, email string) error

UpdateEmail mocks base method.

func (*MockRepository) UpdateSSHKey

func (m *MockRepository) UpdateSSHKey(ctx context.Context, username string, SSHKey entity.SSHKey) error

UpdateSSHKey mocks base method.

func (*MockRepository) UpdateUsername

func (m *MockRepository) UpdateUsername(ctx context.Context, email, userID string) error

UpdateUsername mocks base method.

type MockRepositoryMockRecorder

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

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) Create

func (mr *MockRepositoryMockRecorder) Create(ctx, user interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepositoryMockRecorder) EnsureIndexes

func (mr *MockRepositoryMockRecorder) EnsureIndexes() *gomock.Call

EnsureIndexes indicates an expected call of EnsureIndexes.

func (*MockRepositoryMockRecorder) FindAll

func (mr *MockRepositoryMockRecorder) FindAll(ctx, includeDeleted interface{}) *gomock.Call

FindAll indicates an expected call of FindAll.

func (*MockRepositoryMockRecorder) FindByIDs

func (mr *MockRepositoryMockRecorder) FindByIDs(ctx, userIDs interface{}) *gomock.Call

FindByIDs indicates an expected call of FindByIDs.

func (*MockRepositoryMockRecorder) Get

func (mr *MockRepositoryMockRecorder) Get(ctx, id interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockRepositoryMockRecorder) GetByEmail

func (mr *MockRepositoryMockRecorder) GetByEmail(ctx, email interface{}) *gomock.Call

GetByEmail indicates an expected call of GetByEmail.

func (*MockRepositoryMockRecorder) GetByUsername

func (mr *MockRepositoryMockRecorder) GetByUsername(ctx, username interface{}) *gomock.Call

GetByUsername indicates an expected call of GetByUsername.

func (*MockRepositoryMockRecorder) UpdateAccessLevel

func (mr *MockRepositoryMockRecorder) UpdateAccessLevel(ctx, userIDs, level interface{}) *gomock.Call

UpdateAccessLevel indicates an expected call of UpdateAccessLevel.

func (*MockRepositoryMockRecorder) UpdateDeleted

func (mr *MockRepositoryMockRecorder) UpdateDeleted(ctx, userID, deleted interface{}) *gomock.Call

UpdateDeleted indicates an expected call of UpdateDeleted.

func (*MockRepositoryMockRecorder) UpdateEmail

func (mr *MockRepositoryMockRecorder) UpdateEmail(ctx, userID, email interface{}) *gomock.Call

UpdateEmail indicates an expected call of UpdateEmail.

func (*MockRepositoryMockRecorder) UpdateSSHKey

func (mr *MockRepositoryMockRecorder) UpdateSSHKey(ctx, username, SSHKey interface{}) *gomock.Call

UpdateSSHKey indicates an expected call of UpdateSSHKey.

func (*MockRepositoryMockRecorder) UpdateUsername

func (mr *MockRepositoryMockRecorder) UpdateUsername(ctx, email, userID interface{}) *gomock.Call

UpdateUsername indicates an expected call of UpdateUsername.

type MockUseCase

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

MockUseCase is a mock of UseCase interface.

func NewMockUseCase

func NewMockUseCase(ctrl *gomock.Controller) *MockUseCase

NewMockUseCase creates a new mock instance.

func (*MockUseCase) AreToolsRunning

func (m *MockUseCase) AreToolsRunning(ctx context.Context, username string) (bool, error)

AreToolsRunning mocks base method.

func (*MockUseCase) Create

func (m *MockUseCase) Create(ctx context.Context, email, username string, accessLevel entity.AccessLevel) (entity.User, error)

Create mocks base method.

func (*MockUseCase) CreateAdminUser

func (m *MockUseCase) CreateAdminUser(username, email string) error

CreateAdminUser mocks base method.

func (*MockUseCase) EXPECT

func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUseCase) FindAll

func (m *MockUseCase) FindAll(ctx context.Context) ([]entity.User, error)

FindAll mocks base method.

func (*MockUseCase) FindByIDs

func (m *MockUseCase) FindByIDs(ctx context.Context, userIDs []string) ([]entity.User, error)

FindByIDs mocks base method.

func (*MockUseCase) GetByID

func (m *MockUseCase) GetByID(ctx context.Context, userID string) (entity.User, error)

GetByID mocks base method.

func (*MockUseCase) GetByUsername

func (m *MockUseCase) GetByUsername(ctx context.Context, username string) (entity.User, error)

GetByUsername mocks base method.

func (*MockUseCase) GetKubeconfig

func (m *MockUseCase) GetKubeconfig(ctx context.Context, username string) (string, error)

GetKubeconfig mocks base method.

func (*MockUseCase) IsKubeconfigActive

func (m *MockUseCase) IsKubeconfigActive() bool

IsKubeconfigActive mocks base method.

func (*MockUseCase) RegenerateSSHKeys

func (m *MockUseCase) RegenerateSSHKeys(ctx context.Context, user entity.User) (entity.User, error)

RegenerateSSHKeys mocks base method.

func (*MockUseCase) RunSyncUsersCronJob

func (m *MockUseCase) RunSyncUsersCronJob()

RunSyncUsersCronJob mocks base method.

func (*MockUseCase) ScheduleUsersSyncJob

func (m *MockUseCase) ScheduleUsersSyncJob(interval time.Duration) error

ScheduleUsersSyncJob mocks base method.

func (*MockUseCase) StartTools

func (m *MockUseCase) StartTools(ctx context.Context, username string, runtimeID, capabilitiesID *string) (entity.User, error)

StartTools mocks base method.

func (*MockUseCase) StopTools

func (m *MockUseCase) StopTools(ctx context.Context, username string) (entity.User, error)

StopTools mocks base method.

func (*MockUseCase) SynchronizeServiceAccountsForUsers

func (m *MockUseCase) SynchronizeServiceAccountsForUsers() error

SynchronizeServiceAccountsForUsers mocks base method.

func (*MockUseCase) UpdateAccessLevel

func (m *MockUseCase) UpdateAccessLevel(ctx context.Context, userIds []string, level entity.AccessLevel) ([]entity.User, error)

UpdateAccessLevel mocks base method.

type MockUseCaseMockRecorder

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

MockUseCaseMockRecorder is the mock recorder for MockUseCase.

func (*MockUseCaseMockRecorder) AreToolsRunning

func (mr *MockUseCaseMockRecorder) AreToolsRunning(ctx, username interface{}) *gomock.Call

AreToolsRunning indicates an expected call of AreToolsRunning.

func (*MockUseCaseMockRecorder) Create

func (mr *MockUseCaseMockRecorder) Create(ctx, email, username, accessLevel interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockUseCaseMockRecorder) CreateAdminUser

func (mr *MockUseCaseMockRecorder) CreateAdminUser(username, email interface{}) *gomock.Call

CreateAdminUser indicates an expected call of CreateAdminUser.

func (*MockUseCaseMockRecorder) FindAll

func (mr *MockUseCaseMockRecorder) FindAll(ctx interface{}) *gomock.Call

FindAll indicates an expected call of FindAll.

func (*MockUseCaseMockRecorder) FindByIDs

func (mr *MockUseCaseMockRecorder) FindByIDs(ctx, userIDs interface{}) *gomock.Call

FindByIDs indicates an expected call of FindByIDs.

func (*MockUseCaseMockRecorder) GetByID

func (mr *MockUseCaseMockRecorder) GetByID(ctx, userID interface{}) *gomock.Call

GetByID indicates an expected call of GetByID.

func (*MockUseCaseMockRecorder) GetByUsername

func (mr *MockUseCaseMockRecorder) GetByUsername(ctx, username interface{}) *gomock.Call

GetByUsername indicates an expected call of GetByUsername.

func (*MockUseCaseMockRecorder) GetKubeconfig

func (mr *MockUseCaseMockRecorder) GetKubeconfig(ctx, username interface{}) *gomock.Call

GetKubeconfig indicates an expected call of GetKubeconfig.

func (*MockUseCaseMockRecorder) IsKubeconfigActive

func (mr *MockUseCaseMockRecorder) IsKubeconfigActive() *gomock.Call

IsKubeconfigActive indicates an expected call of IsKubeconfigActive.

func (*MockUseCaseMockRecorder) RegenerateSSHKeys

func (mr *MockUseCaseMockRecorder) RegenerateSSHKeys(ctx, user interface{}) *gomock.Call

RegenerateSSHKeys indicates an expected call of RegenerateSSHKeys.

func (*MockUseCaseMockRecorder) RunSyncUsersCronJob

func (mr *MockUseCaseMockRecorder) RunSyncUsersCronJob() *gomock.Call

RunSyncUsersCronJob indicates an expected call of RunSyncUsersCronJob.

func (*MockUseCaseMockRecorder) ScheduleUsersSyncJob

func (mr *MockUseCaseMockRecorder) ScheduleUsersSyncJob(interval interface{}) *gomock.Call

ScheduleUsersSyncJob indicates an expected call of ScheduleUsersSyncJob.

func (*MockUseCaseMockRecorder) StartTools

func (mr *MockUseCaseMockRecorder) StartTools(ctx, username, runtimeID, capabilitiesID interface{}) *gomock.Call

StartTools indicates an expected call of StartTools.

func (*MockUseCaseMockRecorder) StopTools

func (mr *MockUseCaseMockRecorder) StopTools(ctx, username interface{}) *gomock.Call

StopTools indicates an expected call of StopTools.

func (*MockUseCaseMockRecorder) SynchronizeServiceAccountsForUsers

func (mr *MockUseCaseMockRecorder) SynchronizeServiceAccountsForUsers() *gomock.Call

SynchronizeServiceAccountsForUsers indicates an expected call of SynchronizeServiceAccountsForUsers.

func (*MockUseCaseMockRecorder) UpdateAccessLevel

func (mr *MockUseCaseMockRecorder) UpdateAccessLevel(ctx, userIds, level interface{}) *gomock.Call

UpdateAccessLevel indicates an expected call of UpdateAccessLevel.

type Repository

type Repository interface {
	EnsureIndexes() error
	Get(ctx context.Context, id string) (entity.User, error)
	GetByUsername(ctx context.Context, username string) (entity.User, error)
	GetByEmail(ctx context.Context, email string) (entity.User, error)
	Create(ctx context.Context, user entity.User) (string, error)
	UpdateAccessLevel(ctx context.Context, userIDs []string, level entity.AccessLevel) error
	UpdateSSHKey(ctx context.Context, username string, SSHKey entity.SSHKey) error
	FindAll(ctx context.Context, includeDeleted bool) ([]entity.User, error)
	FindByIDs(ctx context.Context, userIDs []string) ([]entity.User, error)
	UpdateEmail(ctx context.Context, userID, email string) error
	UpdateUsername(ctx context.Context, email, userID string) error
	UpdateDeleted(ctx context.Context, userID string, deleted bool) error
}

Repository interface to retrieve and persists users.

type UseCase

type UseCase interface {
	Create(ctx context.Context, email, username string, accessLevel entity.AccessLevel) (entity.User, error)
	CreateAdminUser(username, email string) error
	UpdateAccessLevel(ctx context.Context, userIds []string, level entity.AccessLevel) ([]entity.User, error)
	FindAll(ctx context.Context) ([]entity.User, error)
	GetByUsername(ctx context.Context, username string) (entity.User, error)
	StartTools(ctx context.Context, username string, runtimeID *string, capabilitiesID *string) (entity.User, error)
	StopTools(ctx context.Context, username string) (entity.User, error)
	AreToolsRunning(ctx context.Context, username string) (bool, error)
	IsKubeconfigActive() bool
	FindByIDs(ctx context.Context, userIDs []string) ([]entity.User, error)
	GetByID(ctx context.Context, userID string) (entity.User, error)
	RegenerateSSHKeys(ctx context.Context, user entity.User) (entity.User, error)
	ScheduleUsersSyncJob(interval time.Duration) error
	RunSyncUsersCronJob()
	GetKubeconfig(ctx context.Context, username string) (string, error)
	SynchronizeServiceAccountsForUsers() error
}

UseCase interface to manage all operations related with users.

func NewInteractor

func NewInteractor(
	logger logging.Logger,
	cfg config.Config,
	repo Repository,
	repoRuntimes runtime.Repository,
	repoCapabilities capabilities.Repository,
	sshGenerator sshhelper.SSHKeyGenerator,
	c clock.Clock,
	giteaService giteaservice.GiteaClient,
	k8sClient k8s.Client,
) UseCase

NewInteractor factory function.

Jump to

Keyboard shortcuts

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