test

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAWSIntegrationRepository

func NewAWSIntegrationRepository(canQuery bool) repository.AWSIntegrationRepository

NewAWSIntegrationRepository will return errors if canQuery is false

func NewAuthCodeRepository

func NewAuthCodeRepository(canQuery bool) repository.AuthCodeRepository

NewAuthCodeRepository returns a AuthCodeRepository which uses gorm.DB for querying the database

func NewBasicIntegrationRepository

func NewBasicIntegrationRepository(canQuery bool) repository.BasicIntegrationRepository

NewBasicIntegrationRepository will return errors if canQuery is false

func NewClusterRepository

func NewClusterRepository(canQuery bool) repository.ClusterRepository

NewClusterRepository will return errors if canQuery is false

func NewDNSRecordRepository

func NewDNSRecordRepository(canQuery bool) repository.DNSRecordRepository

NewDNSRecordRepository will return errors if canQuery is false

func NewGCPIntegrationRepository

func NewGCPIntegrationRepository(canQuery bool) repository.GCPIntegrationRepository

NewGCPIntegrationRepository will return errors if canQuery is false

func NewGitRepoRepository

func NewGitRepoRepository(canQuery bool) repository.GitRepoRepository

NewGitRepoRepository will return errors if canQuery is false

func NewHelmRepoRepository

func NewHelmRepoRepository(canQuery bool) repository.HelmRepoRepository

NewHelmRepoRepository will return errors if canQuery is false

func NewInfraRepository

func NewInfraRepository(canQuery bool) repository.InfraRepository

NewInfraRepository will return errors if canQuery is false

func NewInviteRepository

func NewInviteRepository(canQuery bool) repository.InviteRepository

NewInviteRepository returns a InviteRepository which uses gorm.DB for querying the database

func NewKubeIntegrationRepository

func NewKubeIntegrationRepository(canQuery bool) repository.KubeIntegrationRepository

NewKubeIntegrationRepository will return errors if canQuery is false

func NewOAuthIntegrationRepository

func NewOAuthIntegrationRepository(canQuery bool) repository.OAuthIntegrationRepository

NewOAuthIntegrationRepository will return errors if canQuery is false

func NewOIDCIntegrationRepository

func NewOIDCIntegrationRepository(canQuery bool) repository.OIDCIntegrationRepository

NewOIDCIntegrationRepository will return errors if canQuery is false

func NewPWResetTokenRepository

func NewPWResetTokenRepository(canQuery bool) repository.PWResetTokenRepository

NewPWResetTokenRepository returns a PWResetTokenRepository which uses gorm.DB for querying the database

func NewProjectRepository

func NewProjectRepository(canQuery bool) repository.ProjectRepository

NewProjectRepository will return errors if canQuery is false

func NewRegistryRepository

func NewRegistryRepository(canQuery bool) repository.RegistryRepository

NewRegistryRepository will return errors if canQuery is false

func NewRepository

func NewRepository(canQuery bool) *repository.Repository

NewRepository returns a Repository which persists users in memory and accepts a parameter that can trigger read/write errors

func NewSessionRepository

func NewSessionRepository(canQuery bool) repository.SessionRepository

NewSessionRepository returns pointer to repo along with the db

func NewUserRepository

func NewUserRepository(canQuery bool) repository.UserRepository

NewUserRepository will return errors if canQuery is false

Types

type AWSIntegrationRepository

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

AWSIntegrationRepository implements repository.AWSIntegrationRepository

func (*AWSIntegrationRepository) CreateAWSIntegration

func (repo *AWSIntegrationRepository) CreateAWSIntegration(
	am *ints.AWSIntegration,
) (*ints.AWSIntegration, error)

CreateAWSIntegration creates a new aws auth mechanism

func (*AWSIntegrationRepository) ListAWSIntegrationsByProjectID

func (repo *AWSIntegrationRepository) ListAWSIntegrationsByProjectID(
	projectID uint,
) ([]*ints.AWSIntegration, error)

ListAWSIntegrationsByProjectID finds all aws auth mechanisms for a given project id

func (*AWSIntegrationRepository) OverwriteAWSIntegration added in v0.4.0

func (repo *AWSIntegrationRepository) OverwriteAWSIntegration(
	am *ints.AWSIntegration,
) (*ints.AWSIntegration, error)

func (*AWSIntegrationRepository) ReadAWSIntegration

func (repo *AWSIntegrationRepository) ReadAWSIntegration(
	id uint,
) (*ints.AWSIntegration, error)

ReadAWSIntegration finds a aws auth mechanism by id

type AuthCodeRepository

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

AuthCodeRepository uses gorm.DB for querying the database

func (*AuthCodeRepository) CreateAuthCode

func (repo *AuthCodeRepository) CreateAuthCode(a *models.AuthCode) (*models.AuthCode, error)

CreateAuthCode creates a new invite

func (*AuthCodeRepository) ReadAuthCode

func (repo *AuthCodeRepository) ReadAuthCode(code string) (*models.AuthCode, error)

ReadAuthCode gets an auth code object specified by the unique code

type BasicIntegrationRepository

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

BasicIntegrationRepository implements repository.BasicIntegrationRepository

func (*BasicIntegrationRepository) CreateBasicIntegration

func (repo *BasicIntegrationRepository) CreateBasicIntegration(
	am *ints.BasicIntegration,
) (*ints.BasicIntegration, error)

CreateBasicIntegration creates a new basic auth mechanism

func (*BasicIntegrationRepository) ListBasicIntegrationsByProjectID

func (repo *BasicIntegrationRepository) ListBasicIntegrationsByProjectID(
	projectID uint,
) ([]*ints.BasicIntegration, error)

ListBasicIntegrationsByProjectID finds all basic auth mechanisms for a given project id

func (*BasicIntegrationRepository) ReadBasicIntegration

func (repo *BasicIntegrationRepository) ReadBasicIntegration(
	id uint,
) (*ints.BasicIntegration, error)

ReadBasicIntegration finds a basic auth mechanism by id

type ClusterRepository

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

ClusterRepository implements repository.ClusterRepository

func (*ClusterRepository) CreateCluster

func (repo *ClusterRepository) CreateCluster(
	cluster *models.Cluster,
) (*models.Cluster, error)

CreateCluster creates a new servicea account

func (*ClusterRepository) CreateClusterCandidate

func (repo *ClusterRepository) CreateClusterCandidate(
	cc *models.ClusterCandidate,
) (*models.ClusterCandidate, error)

CreateClusterCandidate creates a new cluster candidate

func (*ClusterRepository) DeleteCluster

func (repo *ClusterRepository) DeleteCluster(
	cluster *models.Cluster,
) error

DeleteCluster removes a cluster from the array by setting it to nil

func (*ClusterRepository) ListClusterCandidatesByProjectID

func (repo *ClusterRepository) ListClusterCandidatesByProjectID(
	projectID uint,
) ([]*models.ClusterCandidate, error)

ListClusterCandidatesByProjectID finds all service account candidates for a given project id

func (*ClusterRepository) ListClustersByProjectID

func (repo *ClusterRepository) ListClustersByProjectID(
	projectID uint,
) ([]*models.Cluster, error)

ListClustersByProjectID finds all service accounts for a given project id

func (*ClusterRepository) ReadCluster

func (repo *ClusterRepository) ReadCluster(
	id uint,
) (*models.Cluster, error)

ReadCluster finds a service account by id

func (*ClusterRepository) ReadClusterCandidate

func (repo *ClusterRepository) ReadClusterCandidate(id uint) (*models.ClusterCandidate, error)

ReadClusterCandidate finds a service account candidate by id

func (*ClusterRepository) UpdateCluster

func (repo *ClusterRepository) UpdateCluster(
	cluster *models.Cluster,
) (*models.Cluster, error)

UpdateCluster modifies an existing Cluster in the database

func (*ClusterRepository) UpdateClusterCandidateCreatedClusterID

func (repo *ClusterRepository) UpdateClusterCandidateCreatedClusterID(
	id uint,
	createdClusterID uint,
) (*models.ClusterCandidate, error)

UpdateClusterCandidateCreatedClusterID updates the CreatedClusterID for a candidate, after the candidate has been resolved.

func (*ClusterRepository) UpdateClusterTokenCache

func (repo *ClusterRepository) UpdateClusterTokenCache(
	tokenCache *ints.ClusterTokenCache,
) (*models.Cluster, error)

UpdateClusterTokenCache updates the token cache for a cluster

type DNSRecordRepository

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

DNSRecordRepository implements repository.DNSRecordRepository

func (*DNSRecordRepository) CreateDNSRecord

func (repo *DNSRecordRepository) CreateDNSRecord(
	record *models.DNSRecord,
) (*models.DNSRecord, error)

CreateDNSRecord creates a new repoistry

type GCPIntegrationRepository

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

GCPIntegrationRepository implements repository.GCPIntegrationRepository

func (*GCPIntegrationRepository) CreateGCPIntegration

func (repo *GCPIntegrationRepository) CreateGCPIntegration(
	am *ints.GCPIntegration,
) (*ints.GCPIntegration, error)

CreateGCPIntegration creates a new gcp auth mechanism

func (*GCPIntegrationRepository) ListGCPIntegrationsByProjectID

func (repo *GCPIntegrationRepository) ListGCPIntegrationsByProjectID(
	projectID uint,
) ([]*ints.GCPIntegration, error)

ListGCPIntegrationsByProjectID finds all gcp auth mechanisms for a given project id

func (*GCPIntegrationRepository) ReadGCPIntegration

func (repo *GCPIntegrationRepository) ReadGCPIntegration(
	id uint,
) (*ints.GCPIntegration, error)

ReadGCPIntegration finds a gcp auth mechanism by id

type GitRepoRepository

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

GitRepoRepository implements repository.GitRepoRepository

func (*GitRepoRepository) CreateGitRepo

func (repo *GitRepoRepository) CreateGitRepo(gr *models.GitRepo) (*models.GitRepo, error)

CreateGitRepo creates a new repo client and appends it to the in-memory list

func (*GitRepoRepository) DeleteGitRepo

func (repo *GitRepoRepository) DeleteGitRepo(
	gr *models.GitRepo,
) error

DeleteGitRepo removes a repoistry from the array by setting it to nil

func (*GitRepoRepository) ListGitReposByProjectID

func (repo *GitRepoRepository) ListGitReposByProjectID(projectID uint) ([]*models.GitRepo, error)

ListGitReposByProjectID returns a list of repo clients that match a project id

func (*GitRepoRepository) ReadGitRepo

func (repo *GitRepoRepository) ReadGitRepo(id uint) (*models.GitRepo, error)

ReadGitRepo returns a repo client by id

func (*GitRepoRepository) UpdateGitRepo

func (repo *GitRepoRepository) UpdateGitRepo(
	gr *models.GitRepo,
) (*models.GitRepo, error)

UpdateGitRepo modifies an existing GitRepo in the database

type HelmRepoRepository

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

HelmRepoRepository implements repository.HelmRepoRepository

func (*HelmRepoRepository) CreateHelmRepo

func (repo *HelmRepoRepository) CreateHelmRepo(
	hr *models.HelmRepo,
) (*models.HelmRepo, error)

CreateHelmRepo creates a new repoistry

func (*HelmRepoRepository) DeleteHelmRepo

func (repo *HelmRepoRepository) DeleteHelmRepo(
	hr *models.HelmRepo,
) error

DeleteHelmRepo removes a repoistry from the array by setting it to nil

func (*HelmRepoRepository) ListHelmReposByProjectID

func (repo *HelmRepoRepository) ListHelmReposByProjectID(
	projectID uint,
) ([]*models.HelmRepo, error)

ListHelmReposByProjectID finds all repoistries for a given project id

func (*HelmRepoRepository) ReadHelmRepo

func (repo *HelmRepoRepository) ReadHelmRepo(
	id uint,
) (*models.HelmRepo, error)

ReadHelmRepo finds a repoistry by id

func (*HelmRepoRepository) UpdateHelmRepo

func (repo *HelmRepoRepository) UpdateHelmRepo(
	hr *models.HelmRepo,
) (*models.HelmRepo, error)

UpdateHelmRepo modifies an existing HelmRepo in the database

func (*HelmRepoRepository) UpdateHelmRepoTokenCache

func (repo *HelmRepoRepository) UpdateHelmRepoTokenCache(
	tokenCache *ints.HelmRepoTokenCache,
) (*models.HelmRepo, error)

UpdateHelmRepoTokenCache updates the token cache for a repoistry

type InfraRepository

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

InfraRepository implements repository.InfraRepository

func (*InfraRepository) CreateInfra

func (repo *InfraRepository) CreateInfra(
	infra *models.Infra,
) (*models.Infra, error)

CreateInfra creates a new aws infra

func (*InfraRepository) ListInfrasByProjectID

func (repo *InfraRepository) ListInfrasByProjectID(
	projectID uint,
) ([]*models.Infra, error)

ListInfrasByProjectID finds all aws infras for a given project id

func (*InfraRepository) ReadInfra

func (repo *InfraRepository) ReadInfra(
	id uint,
) (*models.Infra, error)

ReadInfra finds a aws infra by id

func (*InfraRepository) UpdateInfra

func (repo *InfraRepository) UpdateInfra(
	ai *models.Infra,
) (*models.Infra, error)

UpdateInfra modifies an existing Infra in the database

type InviteRepository

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

InviteRepository uses gorm.DB for querying the database

func (*InviteRepository) CreateInvite

func (repo *InviteRepository) CreateInvite(invite *models.Invite) (*models.Invite, error)

CreateInvite creates a new invite

func (*InviteRepository) DeleteInvite

func (repo *InviteRepository) DeleteInvite(
	invite *models.Invite,
) error

DeleteInvite removes a registry from the db

func (*InviteRepository) ListInvitesByProjectID

func (repo *InviteRepository) ListInvitesByProjectID(
	projectID uint,
) ([]*models.Invite, error)

ListInvitesByProjectID finds all invites for a given project id

func (*InviteRepository) ReadInvite

func (repo *InviteRepository) ReadInvite(id uint) (*models.Invite, error)

ReadInvite gets an invite specified by a unique id

func (*InviteRepository) ReadInviteByToken

func (repo *InviteRepository) ReadInviteByToken(token string) (*models.Invite, error)

ReadInviteByToken gets an invite specified by a unique token

func (*InviteRepository) UpdateInvite

func (repo *InviteRepository) UpdateInvite(
	invite *models.Invite,
) (*models.Invite, error)

UpdateInvite updates an invitation in the DB

type KubeIntegrationRepository

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

KubeIntegrationRepository implements repository.KubeIntegrationRepository

func (*KubeIntegrationRepository) CreateKubeIntegration

func (repo *KubeIntegrationRepository) CreateKubeIntegration(
	am *ints.KubeIntegration,
) (*ints.KubeIntegration, error)

CreateKubeIntegration creates a new kube auth mechanism

func (*KubeIntegrationRepository) ListKubeIntegrationsByProjectID

func (repo *KubeIntegrationRepository) ListKubeIntegrationsByProjectID(
	projectID uint,
) ([]*ints.KubeIntegration, error)

ListKubeIntegrationsByProjectID finds all kube auth mechanisms for a given project id

func (*KubeIntegrationRepository) ReadKubeIntegration

func (repo *KubeIntegrationRepository) ReadKubeIntegration(
	id uint,
) (*ints.KubeIntegration, error)

ReadKubeIntegration finds a kube auth mechanism by id

type OAuthIntegrationRepository

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

OAuthIntegrationRepository implements repository.OAuthIntegrationRepository

func (*OAuthIntegrationRepository) CreateOAuthIntegration

func (repo *OAuthIntegrationRepository) CreateOAuthIntegration(
	am *ints.OAuthIntegration,
) (*ints.OAuthIntegration, error)

CreateOAuthIntegration creates a new o auth mechanism

func (*OAuthIntegrationRepository) ListOAuthIntegrationsByProjectID

func (repo *OAuthIntegrationRepository) ListOAuthIntegrationsByProjectID(
	projectID uint,
) ([]*ints.OAuthIntegration, error)

ListOAuthIntegrationsByProjectID finds all o auth mechanisms for a given project id

func (*OAuthIntegrationRepository) ReadOAuthIntegration

func (repo *OAuthIntegrationRepository) ReadOAuthIntegration(
	id uint,
) (*ints.OAuthIntegration, error)

ReadOAuthIntegration finds a o auth mechanism by id

func (*OAuthIntegrationRepository) UpdateOAuthIntegration

func (repo *OAuthIntegrationRepository) UpdateOAuthIntegration(
	am *ints.OAuthIntegration,
) (*ints.OAuthIntegration, error)

UpdateOAuthIntegration updates an oauth integration in the DB

type OIDCIntegrationRepository

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

OIDCIntegrationRepository implements repository.OIDCIntegrationRepository

func (*OIDCIntegrationRepository) CreateOIDCIntegration

func (repo *OIDCIntegrationRepository) CreateOIDCIntegration(
	am *ints.OIDCIntegration,
) (*ints.OIDCIntegration, error)

CreateOIDCIntegration creates a new oidc auth mechanism

func (*OIDCIntegrationRepository) ListOIDCIntegrationsByProjectID

func (repo *OIDCIntegrationRepository) ListOIDCIntegrationsByProjectID(
	projectID uint,
) ([]*ints.OIDCIntegration, error)

ListOIDCIntegrationsByProjectID finds all oidc auth mechanisms for a given project id

func (*OIDCIntegrationRepository) ReadOIDCIntegration

func (repo *OIDCIntegrationRepository) ReadOIDCIntegration(
	id uint,
) (*ints.OIDCIntegration, error)

ReadOIDCIntegration finds a oidc auth mechanism by id

type PWResetTokenRepository

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

PWResetTokenRepository uses gorm.DB for querying the database

func (*PWResetTokenRepository) CreatePWResetToken

func (repo *PWResetTokenRepository) CreatePWResetToken(a *models.PWResetToken) (*models.PWResetToken, error)

CreatePWResetToken creates a new invite

func (*PWResetTokenRepository) ReadPWResetToken

func (repo *PWResetTokenRepository) ReadPWResetToken(id uint) (*models.PWResetToken, error)

ReadPWResetToken gets an auth code object specified by the unique code

func (*PWResetTokenRepository) UpdatePWResetToken

func (repo *PWResetTokenRepository) UpdatePWResetToken(
	pwToken *models.PWResetToken,
) (*models.PWResetToken, error)

UpdatePWResetToken modifies an existing PWResetToken in the database

type ProjectRepository

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

ProjectRepository will return errors on queries if canQuery is false and only stores a small set of projects in-memory that are indexed by their array index + 1

func (*ProjectRepository) CreateProject

func (repo *ProjectRepository) CreateProject(project *models.Project) (*models.Project, error)

CreateProject appends a new project to the in-memory projects array

func (*ProjectRepository) CreateProjectRole

func (repo *ProjectRepository) CreateProjectRole(project *models.Project, role *models.Role) (*models.Role, error)

CreateProjectRole appends a role to the existing array of roles

func (*ProjectRepository) DeleteProject

func (repo *ProjectRepository) DeleteProject(project *models.Project) (*models.Project, error)

DeleteProject removes a project

func (*ProjectRepository) ListProjectsByUserID

func (repo *ProjectRepository) ListProjectsByUserID(userID uint) ([]*models.Project, error)

ListProjectsByUserID lists projects where a user has an associated role

func (*ProjectRepository) ReadProject

func (repo *ProjectRepository) ReadProject(id uint) (*models.Project, error)

ReadProject gets a projects specified by a unique id

type RegistryRepository

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

RegistryRepository implements repository.RegistryRepository

func (*RegistryRepository) CreateRegistry

func (repo *RegistryRepository) CreateRegistry(
	reg *models.Registry,
) (*models.Registry, error)

CreateRegistry creates a new registry

func (*RegistryRepository) DeleteRegistry

func (repo *RegistryRepository) DeleteRegistry(
	reg *models.Registry,
) error

DeleteRegistry removes a registry from the array by setting it to nil

func (*RegistryRepository) ListRegistriesByProjectID

func (repo *RegistryRepository) ListRegistriesByProjectID(
	projectID uint,
) ([]*models.Registry, error)

ListRegistriesByProjectID finds all registries for a given project id

func (*RegistryRepository) ReadRegistry

func (repo *RegistryRepository) ReadRegistry(
	id uint,
) (*models.Registry, error)

ReadRegistry finds a registry by id

func (*RegistryRepository) UpdateRegistry

func (repo *RegistryRepository) UpdateRegistry(
	reg *models.Registry,
) (*models.Registry, error)

UpdateRegistry modifies an existing Registry in the database

func (*RegistryRepository) UpdateRegistryTokenCache

func (repo *RegistryRepository) UpdateRegistryTokenCache(
	tokenCache *ints.RegTokenCache,
) (*models.Registry, error)

UpdateRegistryTokenCache updates the token cache for a registry

type SessionRepository

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

SessionRepository uses gorm.DB for querying the database

func (*SessionRepository) CreateSession

func (repo *SessionRepository) CreateSession(session *models.Session) (*models.Session, error)

CreateSession must take in Key, Data, and ExpiresAt as arguments.

func (*SessionRepository) DeleteSession

func (repo *SessionRepository) DeleteSession(session *models.Session) (*models.Session, error)

DeleteSession deletes a session by Key

func (*SessionRepository) SelectSession

func (repo *SessionRepository) SelectSession(session *models.Session) (*models.Session, error)

SelectSession returns a session with matching key

func (*SessionRepository) UpdateSession

func (repo *SessionRepository) UpdateSession(session *models.Session) (*models.Session, error)

UpdateSession updates only the Data field using Key as selector.

type UserRepository

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

UserRepository will return errors on queries if canQuery is false and only stores a small set of users in-memory that are indexed by their array index + 1

func (*UserRepository) CheckPassword

func (repo *UserRepository) CheckPassword(id int, pwd string) (bool, error)

CheckPassword checks the input password is correct for the provided user id.

func (*UserRepository) CreateUser

func (repo *UserRepository) CreateUser(user *models.User) (*models.User, error)

CreateUser adds a new User row to the Users table in array memory

func (*UserRepository) DeleteUser

func (repo *UserRepository) DeleteUser(user *models.User) (*models.User, error)

DeleteUser deletes a single user using their unique id

func (*UserRepository) ReadUser

func (repo *UserRepository) ReadUser(id uint) (*models.User, error)

ReadUser finds a single user based on their unique id

func (*UserRepository) ReadUserByEmail

func (repo *UserRepository) ReadUserByEmail(email string) (*models.User, error)

ReadUserByEmail finds a single user based on their unique email

func (*UserRepository) ReadUserByGithubUserID

func (repo *UserRepository) ReadUserByGithubUserID(id int64) (*models.User, error)

ReadUserByGithubUserID finds a single user based on their github id field

func (*UserRepository) ReadUserByGoogleUserID added in v0.3.1

func (repo *UserRepository) ReadUserByGoogleUserID(id string) (*models.User, error)

ReadUserByGoogleUserID finds a single user based on their github id field

func (*UserRepository) UpdateUser

func (repo *UserRepository) UpdateUser(user *models.User) (*models.User, error)

UpdateUser modifies an existing User in the database

Jump to

Keyboard shortcuts

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