test

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAWSInfraRepository

func NewAWSInfraRepository(canQuery bool) repository.AWSInfraRepository

NewAWSInfraRepository will return errors if canQuery is false

func NewAWSIntegrationRepository

func NewAWSIntegrationRepository(canQuery bool) repository.AWSIntegrationRepository

NewAWSIntegrationRepository will return errors if canQuery is false

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 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 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 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 AWSInfraRepository

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

AWSInfraRepository implements repository.AWSInfraRepository

func (*AWSInfraRepository) CreateAWSInfra

func (repo *AWSInfraRepository) CreateAWSInfra(
	infra *models.AWSInfra,
) (*models.AWSInfra, error)

CreateAWSInfra creates a new aws infra

func (*AWSInfraRepository) ListAWSInfrasByProjectID

func (repo *AWSInfraRepository) ListAWSInfrasByProjectID(
	projectID uint,
) ([]*models.AWSInfra, error)

ListAWSInfrasByProjectID finds all aws infras for a given project id

func (*AWSInfraRepository) ReadAWSInfra

func (repo *AWSInfraRepository) ReadAWSInfra(
	id uint,
) (*models.AWSInfra, error)

ReadAWSInfra finds a aws infra by id

func (*AWSInfraRepository) UpdateAWSInfra

func (repo *AWSInfraRepository) UpdateAWSInfra(
	ai *models.AWSInfra,
) (*models.AWSInfra, error)

UpdateAWSInfra modifies an existing AWSInfra in the database

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) ReadAWSIntegration

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

ReadAWSIntegration finds a aws auth mechanism by id

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 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 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

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 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) 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