Documentation
¶
Overview ¶
Package persistence provides an implementation of datalayer.go DataLayer interface. This particular implementation is for Postgres and uses the models in pkg/models/models.go. The migrations are in migrations/[0-9]_create_acyl_models_up.sql.
Index ¶
- func PGClient(config *config.PGConfig) (*sqlx.DB, error)
- type AWSConfig
- type AWSCreds
- type Cleaner
- type DataLayer
- type EnvironmentStatus
- type EventLoggerDataLayer
- type FakeDataLayer
- func (fdl *FakeDataLayer) AddEvent(ctx context.Context, name string, msg string) error
- func (fdl *FakeDataLayer) AppendToEventLog(id uuid.UUID, msg string) error
- func (fdl *FakeDataLayer) Close() error
- func (fdl *FakeDataLayer) CreateEventLog(elog *models.EventLog) error
- func (fdl *FakeDataLayer) CreateHelmReleasesForEnv(ctx context.Context, releases []models.HelmRelease) error
- func (fdl *FakeDataLayer) CreateK8sEnv(ctx context.Context, env *models.KubernetesEnvironment) error
- func (fdl *FakeDataLayer) CreateQAEnvironment(ctx context.Context, qa *QAEnvironment) error
- func (fdl *FakeDataLayer) DeleteEventLog(id uuid.UUID) error
- func (fdl *FakeDataLayer) DeleteEventLogsByEnvName(name string) (uint, error)
- func (fdl *FakeDataLayer) DeleteEventLogsByRepoAndPR(repo string, pr uint) (uint, error)
- func (fdl *FakeDataLayer) DeleteHelmReleasesForEnv(ctx context.Context, name string) (uint, error)
- func (fdl *FakeDataLayer) DeleteK8sEnv(ctx context.Context, name string) error
- func (fdl *FakeDataLayer) DeleteQAEnvironment(ctx context.Context, name string) error
- func (fdl *FakeDataLayer) GetEventLogByID(id uuid.UUID) (*models.EventLog, error)
- func (fdl *FakeDataLayer) GetEventLogsByEnvName(name string) ([]models.EventLog, error)
- func (fdl *FakeDataLayer) GetEventLogsByRepoAndPR(repo string, pr uint) ([]models.EventLog, error)
- func (fdl *FakeDataLayer) GetExtantQAEnvironments(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetHelmReleasesForEnv(ctx context.Context, name string) ([]models.HelmRelease, error)
- func (fdl *FakeDataLayer) GetK8sEnv(ctx context.Context, name string) (*models.KubernetesEnvironment, error)
- func (fdl *FakeDataLayer) GetK8sEnvsByNamespace(ctx context.Context, ns string) ([]models.KubernetesEnvironment, error)
- func (fdl *FakeDataLayer) GetMostRecent(ctx context.Context, n uint) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironment(ctx context.Context, name string) (*QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentBySourceSHA(ctx context.Context, sourceSHA string) (*QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentConsistently(ctx context.Context, name string) (*QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentsByRepo(ctx context.Context, repo string) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentsByRepoAndPR(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentsBySourceBranch(ctx context.Context, sourceBranch string) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentsByStatus(ctx context.Context, status string) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetQAEnvironmentsByUser(ctx context.Context, user string) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) GetRunningQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) Load(dir string) error
- func (fdl *FakeDataLayer) Save(dir string) ([]string, error)
- func (fdl *FakeDataLayer) Search(ctx context.Context, opts models.EnvSearchParameters) ([]QAEnvironment, error)
- func (fdl *FakeDataLayer) SetAminoEnvironmentID(ctx context.Context, name string, did int) error
- func (fdl *FakeDataLayer) SetAminoKubernetesNamespace(ctx context.Context, name, namespace string) error
- func (fdl *FakeDataLayer) SetAminoServiceToPort(ctx context.Context, name string, serviceToPort map[string]int64) error
- func (fdl *FakeDataLayer) SetDelay(d time.Duration)
- func (fdl *FakeDataLayer) SetEventLogEnvName(id uuid.UUID, name string) error
- func (fdl *FakeDataLayer) SetQAEnvironmentCommitSHAMap(ctx context.Context, name string, csm RefMap) error
- func (fdl *FakeDataLayer) SetQAEnvironmentCreated(ctx context.Context, name string, ts time.Time) error
- func (fdl *FakeDataLayer) SetQAEnvironmentRefMap(ctx context.Context, name string, rm RefMap) error
- func (fdl *FakeDataLayer) SetQAEnvironmentRepoData(ctx context.Context, name string, rrd *RepoRevisionData) error
- func (fdl *FakeDataLayer) SetQAEnvironmentStatus(ctx context.Context, name string, status EnvironmentStatus) error
- func (fdl *FakeDataLayer) UpdateHelmReleaseRevision(ctx context.Context, envname, release, revision string) error
- func (fdl *FakeDataLayer) UpdateK8sEnvTillerAddr(ctx context.Context, envname, taddr string) error
- type HelmDataLayer
- type K8sEnvDataLayer
- type LogFunc
- type MetricsCollector
- type PGLayer
- func (p *PGLayer) AddEvent(ctx context.Context, name string, msg string) error
- func (pg *PGLayer) AppendToEventLog(id uuid.UUID, msg string) error
- func (p *PGLayer) Close() error
- func (pg *PGLayer) CreateEventLog(elog *models.EventLog) error
- func (pg *PGLayer) CreateHelmReleasesForEnv(ctx context.Context, releases []models.HelmRelease) error
- func (pg *PGLayer) CreateK8sEnv(ctx context.Context, env *models.KubernetesEnvironment) error
- func (p *PGLayer) CreateQAEnvironment(ctx context.Context, qae *QAEnvironment) error
- func (p *PGLayer) DB() *sqlx.DB
- func (pg *PGLayer) DeleteEventLog(id uuid.UUID) error
- func (pg *PGLayer) DeleteEventLogsByEnvName(name string) (uint, error)
- func (pg *PGLayer) DeleteEventLogsByRepoAndPR(repo string, pr uint) (uint, error)
- func (pg *PGLayer) DeleteHelmReleasesForEnv(ctx context.Context, name string) (uint, error)
- func (pg *PGLayer) DeleteK8sEnv(ctx context.Context, name string) error
- func (p *PGLayer) DeleteQAEnvironment(ctx context.Context, name string) (err error)
- func (pg *PGLayer) GetEventLogByID(id uuid.UUID) (*models.EventLog, error)
- func (pg *PGLayer) GetEventLogsByEnvName(name string) ([]models.EventLog, error)
- func (pg *PGLayer) GetEventLogsByRepoAndPR(repo string, pr uint) ([]models.EventLog, error)
- func (p *PGLayer) GetExtantQAEnvironments(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
- func (pg *PGLayer) GetHelmReleasesForEnv(ctx context.Context, name string) ([]models.HelmRelease, error)
- func (pg *PGLayer) GetK8sEnv(ctx context.Context, name string) (*models.KubernetesEnvironment, error)
- func (pg *PGLayer) GetK8sEnvsByNamespace(ctx context.Context, ns string) ([]models.KubernetesEnvironment, error)
- func (p *PGLayer) GetMostRecent(ctx context.Context, n uint) ([]QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironment(ctx context.Context, name string) (*QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentBySourceSHA(ctx context.Context, sourceSHA string) (*QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentConsistently(ctx context.Context, name string) (*QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentsByRepo(ctx context.Context, repo string) ([]QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentsByRepoAndPR(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentsBySourceBranch(ctx context.Context, sourceBranch string) ([]QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentsByStatus(ctx context.Context, status string) ([]QAEnvironment, error)
- func (p *PGLayer) GetQAEnvironmentsByUser(ctx context.Context, user string) ([]QAEnvironment, error)
- func (p *PGLayer) GetRunningQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
- func (p *PGLayer) Search(ctx context.Context, opts models.EnvSearchParameters) ([]QAEnvironment, error)
- func (p *PGLayer) SetAminoEnvironmentID(ctx context.Context, name string, did int) error
- func (p *PGLayer) SetAminoKubernetesNamespace(ctx context.Context, name string, namespace string) error
- func (p *PGLayer) SetAminoServiceToPort(ctx context.Context, name string, serviceToPort map[string]int64) error
- func (pg *PGLayer) SetEventLogEnvName(id uuid.UUID, name string) error
- func (p *PGLayer) SetQAEnvironmentCommitSHAMap(ctx context.Context, name string, commitSHAMap RefMap) error
- func (p *PGLayer) SetQAEnvironmentCreated(ctx context.Context, name string, created time.Time) error
- func (p *PGLayer) SetQAEnvironmentRefMap(ctx context.Context, name string, refMap RefMap) error
- func (p *PGLayer) SetQAEnvironmentRepoData(ctx context.Context, name string, repo *RepoRevisionData) error
- func (p *PGLayer) SetQAEnvironmentStatus(ctx context.Context, name string, status EnvironmentStatus) error
- func (pg *PGLayer) UpdateHelmReleaseRevision(ctx context.Context, envname, release, revision string) error
- func (pg *PGLayer) UpdateK8sEnvTillerAddr(ctx context.Context, envname, taddr string) error
- type QADestroyReason
- type QAEnvironment
- type QAEnvironmentEvent
- type QAEnvironments
- type QAType
- type RefMap
- type RepoRevisionData
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cleaner ¶
type Cleaner struct { // DB must be an initialized SQL client DB *sqlx.DB // Maximum ages for old DB records DestroyedEnvRecordsMaxAge, EventLogsMaxAge time.Duration // LogFunc is a function that logs a formatted string somewhere LogFunc func(string, ...interface{}) }
Cleaner is an object that performs data model clean up operations
func (*Cleaner) PruneDestroyedEnvRecords ¶
PruneDestroyedEnvRecords deletes all QAEnvironment records with status Destroyed or Failed with a Created timestamp earlier than time.Now() - olderThan. olderThan must be > 0
type DataLayer ¶
type DataLayer interface { CreateQAEnvironment(context.Context, *QAEnvironment) error GetQAEnvironment(context.Context, string) (*QAEnvironment, error) GetQAEnvironmentConsistently(context.Context, string) (*QAEnvironment, error) GetQAEnvironments(context.Context) ([]QAEnvironment, error) DeleteQAEnvironment(context.Context, string) error GetQAEnvironmentsByStatus(ctx context.Context, status string) ([]QAEnvironment, error) GetRunningQAEnvironments(context.Context) ([]QAEnvironment, error) GetQAEnvironmentsByRepoAndPR(context.Context, string, uint) ([]QAEnvironment, error) GetQAEnvironmentsByRepo(ctx context.Context, repo string) ([]QAEnvironment, error) GetQAEnvironmentBySourceSHA(ctx context.Context, sourceSHA string) (*QAEnvironment, error) GetQAEnvironmentsBySourceBranch(ctx context.Context, sourceBranch string) ([]QAEnvironment, error) GetQAEnvironmentsByUser(ctx context.Context, user string) ([]QAEnvironment, error) SetQAEnvironmentStatus(context.Context, string, EnvironmentStatus) error SetQAEnvironmentRepoData(context.Context, string, *RepoRevisionData) error SetQAEnvironmentRefMap(context.Context, string, RefMap) error SetQAEnvironmentCommitSHAMap(context.Context, string, RefMap) error SetQAEnvironmentCreated(context.Context, string, time.Time) error GetExtantQAEnvironments(context.Context, string, uint) ([]QAEnvironment, error) SetAminoEnvironmentID(ctx context.Context, name string, did int) error SetAminoServiceToPort(ctx context.Context, name string, serviceToPort map[string]int64) error SetAminoKubernetesNamespace(ctx context.Context, name, namespace string) error AddEvent(context.Context, string, string) error Search(ctx context.Context, opts models.EnvSearchParameters) ([]QAEnvironment, error) GetMostRecent(ctx context.Context, n uint) ([]QAEnvironment, error) Close() error HelmDataLayer K8sEnvDataLayer EventLoggerDataLayer }
DataLayer describes an object that interacts with the persistant data store
type EnvironmentStatus ¶
type EnvironmentStatus = models.EnvironmentStatus
type EventLoggerDataLayer ¶
type EventLoggerDataLayer interface { GetEventLogByID(id uuid.UUID) (*models.EventLog, error) GetEventLogsByEnvName(name string) ([]models.EventLog, error) GetEventLogsByRepoAndPR(repo string, pr uint) ([]models.EventLog, error) CreateEventLog(elog *models.EventLog) error SetEventLogEnvName(id uuid.UUID, name string) error AppendToEventLog(id uuid.UUID, msg string) error DeleteEventLog(id uuid.UUID) error DeleteEventLogsByEnvName(name string) (uint, error) DeleteEventLogsByRepoAndPR(repo string, pr uint) (uint, error) }
EventLoggerDataLayer desribes an object that stores event log data
type FakeDataLayer ¶
type FakeDataLayer struct {
// contains filtered or unexported fields
}
FakeDataLayer is a fake implementation of DataLayer that persists data in-memory, for testing purposes
func NewDelayedFakeDataLayer ¶ added in v0.7.0
func NewDelayedFakeDataLayer(delay time.Duration) *FakeDataLayer
func NewFakeDataLayer ¶
func NewFakeDataLayer() *FakeDataLayer
func NewPopulatedFakeDataLayer ¶
func NewPopulatedFakeDataLayer(qaenvs []models.QAEnvironment, k8senvs []models.KubernetesEnvironment, helmreleases []models.HelmRelease) *FakeDataLayer
NewPopulatedFakeDataLayer returns a FakeDataLayer populated with the supplied data. Input data is not checked for consistency.
func (*FakeDataLayer) AppendToEventLog ¶
func (fdl *FakeDataLayer) AppendToEventLog(id uuid.UUID, msg string) error
func (*FakeDataLayer) Close ¶
func (fdl *FakeDataLayer) Close() error
func (*FakeDataLayer) CreateEventLog ¶
func (fdl *FakeDataLayer) CreateEventLog(elog *models.EventLog) error
func (*FakeDataLayer) CreateHelmReleasesForEnv ¶
func (fdl *FakeDataLayer) CreateHelmReleasesForEnv(ctx context.Context, releases []models.HelmRelease) error
func (*FakeDataLayer) CreateK8sEnv ¶
func (fdl *FakeDataLayer) CreateK8sEnv(ctx context.Context, env *models.KubernetesEnvironment) error
func (*FakeDataLayer) CreateQAEnvironment ¶
func (fdl *FakeDataLayer) CreateQAEnvironment(ctx context.Context, qa *QAEnvironment) error
func (*FakeDataLayer) DeleteEventLog ¶
func (fdl *FakeDataLayer) DeleteEventLog(id uuid.UUID) error
func (*FakeDataLayer) DeleteEventLogsByEnvName ¶
func (fdl *FakeDataLayer) DeleteEventLogsByEnvName(name string) (uint, error)
func (*FakeDataLayer) DeleteEventLogsByRepoAndPR ¶
func (fdl *FakeDataLayer) DeleteEventLogsByRepoAndPR(repo string, pr uint) (uint, error)
func (*FakeDataLayer) DeleteHelmReleasesForEnv ¶
func (*FakeDataLayer) DeleteK8sEnv ¶
func (fdl *FakeDataLayer) DeleteK8sEnv(ctx context.Context, name string) error
func (*FakeDataLayer) DeleteQAEnvironment ¶
func (fdl *FakeDataLayer) DeleteQAEnvironment(ctx context.Context, name string) error
func (*FakeDataLayer) GetEventLogByID ¶
func (*FakeDataLayer) GetEventLogsByEnvName ¶
func (fdl *FakeDataLayer) GetEventLogsByEnvName(name string) ([]models.EventLog, error)
func (*FakeDataLayer) GetEventLogsByRepoAndPR ¶
func (*FakeDataLayer) GetExtantQAEnvironments ¶
func (fdl *FakeDataLayer) GetExtantQAEnvironments(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
func (*FakeDataLayer) GetHelmReleasesForEnv ¶
func (fdl *FakeDataLayer) GetHelmReleasesForEnv(ctx context.Context, name string) ([]models.HelmRelease, error)
func (*FakeDataLayer) GetK8sEnv ¶
func (fdl *FakeDataLayer) GetK8sEnv(ctx context.Context, name string) (*models.KubernetesEnvironment, error)
func (*FakeDataLayer) GetK8sEnvsByNamespace ¶
func (fdl *FakeDataLayer) GetK8sEnvsByNamespace(ctx context.Context, ns string) ([]models.KubernetesEnvironment, error)
func (*FakeDataLayer) GetMostRecent ¶
func (fdl *FakeDataLayer) GetMostRecent(ctx context.Context, n uint) ([]QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironment ¶
func (fdl *FakeDataLayer) GetQAEnvironment(ctx context.Context, name string) (*QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentBySourceSHA ¶
func (fdl *FakeDataLayer) GetQAEnvironmentBySourceSHA(ctx context.Context, sourceSHA string) (*QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentConsistently ¶
func (fdl *FakeDataLayer) GetQAEnvironmentConsistently(ctx context.Context, name string) (*QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironments ¶
func (fdl *FakeDataLayer) GetQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentsByRepo ¶
func (fdl *FakeDataLayer) GetQAEnvironmentsByRepo(ctx context.Context, repo string) ([]QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentsByRepoAndPR ¶
func (fdl *FakeDataLayer) GetQAEnvironmentsByRepoAndPR(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentsBySourceBranch ¶
func (fdl *FakeDataLayer) GetQAEnvironmentsBySourceBranch(ctx context.Context, sourceBranch string) ([]QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentsByStatus ¶
func (fdl *FakeDataLayer) GetQAEnvironmentsByStatus(ctx context.Context, status string) ([]QAEnvironment, error)
func (*FakeDataLayer) GetQAEnvironmentsByUser ¶
func (fdl *FakeDataLayer) GetQAEnvironmentsByUser(ctx context.Context, user string) ([]QAEnvironment, error)
func (*FakeDataLayer) GetRunningQAEnvironments ¶
func (fdl *FakeDataLayer) GetRunningQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
func (*FakeDataLayer) Load ¶
func (fdl *FakeDataLayer) Load(dir string) error
Load reads JSON files in dir and loads them, overwriting any existing data
func (*FakeDataLayer) Save ¶
func (fdl *FakeDataLayer) Save(dir string) ([]string, error)
Save writes all data to files in dir and returns the filenames, or error
func (*FakeDataLayer) Search ¶
func (fdl *FakeDataLayer) Search(ctx context.Context, opts models.EnvSearchParameters) ([]QAEnvironment, error)
func (*FakeDataLayer) SetAminoEnvironmentID ¶
func (*FakeDataLayer) SetAminoKubernetesNamespace ¶
func (fdl *FakeDataLayer) SetAminoKubernetesNamespace(ctx context.Context, name, namespace string) error
func (*FakeDataLayer) SetAminoServiceToPort ¶
func (*FakeDataLayer) SetDelay ¶ added in v0.7.0
func (fdl *FakeDataLayer) SetDelay(d time.Duration)
func (*FakeDataLayer) SetEventLogEnvName ¶
func (fdl *FakeDataLayer) SetEventLogEnvName(id uuid.UUID, name string) error
func (*FakeDataLayer) SetQAEnvironmentCommitSHAMap ¶
func (*FakeDataLayer) SetQAEnvironmentCreated ¶
func (*FakeDataLayer) SetQAEnvironmentRefMap ¶
func (*FakeDataLayer) SetQAEnvironmentRepoData ¶
func (fdl *FakeDataLayer) SetQAEnvironmentRepoData(ctx context.Context, name string, rrd *RepoRevisionData) error
func (*FakeDataLayer) SetQAEnvironmentStatus ¶
func (fdl *FakeDataLayer) SetQAEnvironmentStatus(ctx context.Context, name string, status EnvironmentStatus) error
func (*FakeDataLayer) UpdateHelmReleaseRevision ¶
func (fdl *FakeDataLayer) UpdateHelmReleaseRevision(ctx context.Context, envname, release, revision string) error
func (*FakeDataLayer) UpdateK8sEnvTillerAddr ¶
func (fdl *FakeDataLayer) UpdateK8sEnvTillerAddr(ctx context.Context, envname, taddr string) error
type HelmDataLayer ¶
type HelmDataLayer interface { GetHelmReleasesForEnv(ctx context.Context, name string) ([]models.HelmRelease, error) UpdateHelmReleaseRevision(ctx context.Context, envname, release, revision string) error CreateHelmReleasesForEnv(ctx context.Context, releases []models.HelmRelease) error DeleteHelmReleasesForEnv(ctx context.Context, name string) (uint, error) }
HelmDataLayer describes an object that stores data about Helm
type K8sEnvDataLayer ¶
type K8sEnvDataLayer interface { GetK8sEnv(ctx context.Context, name string) (*models.KubernetesEnvironment, error) GetK8sEnvsByNamespace(ctx context.Context, ns string) ([]models.KubernetesEnvironment, error) CreateK8sEnv(ctx context.Context, env *models.KubernetesEnvironment) error DeleteK8sEnv(ctx context.Context, name string) error UpdateK8sEnvTillerAddr(ctx context.Context, envname, taddr string) error }
K8sEnvDataLayer describes an object that stores data about the K8s environment details
type LogFunc ¶
type LogFunc func(string, ...interface{})
LogFunc is a function that logs a formatted string somewhere
type MetricsCollector ¶
type PGLayer ¶
type PGLayer struct {
// contains filtered or unexported fields
}
PGLayer contains the data layer implementation for a Postgres database.
func NewPGLayer ¶
NewPGLayer instantiates a new PGLayer.
func (*PGLayer) AppendToEventLog ¶
AppendToEventLog appends a new log line to an EventLog
func (*PGLayer) CreateEventLog ¶
CreateEventLog creates a new EventLog
func (*PGLayer) CreateHelmReleasesForEnv ¶
func (*PGLayer) CreateK8sEnv ¶
CreateK8sEnv inserts a new k8s environment into the DB
func (*PGLayer) CreateQAEnvironment ¶
func (p *PGLayer) CreateQAEnvironment(ctx context.Context, qae *QAEnvironment) error
CreateQAEnvironment persists a new QA record.
func (*PGLayer) DeleteEventLog ¶
DeleteEventLog deletes an EventLog
func (*PGLayer) DeleteEventLogsByEnvName ¶
DeleteEventLogsByEnvName deletes all EventLogs associated with an environment and returns the number of EventLogs deleted, or error
func (*PGLayer) DeleteEventLogsByRepoAndPR ¶
DeleteEventLogsByRepoAndPR deletes all EventLogs associated with a repo and PR and returns the number of EventLogs deleted, or error
func (*PGLayer) DeleteHelmReleasesForEnv ¶
func (*PGLayer) DeleteK8sEnv ¶
DeleteK8sEnv deletes a k8s environment from the DB
func (*PGLayer) DeleteQAEnvironment ¶
DeleteQAEnvironment deletes a QA environment record. The environment must have status Destroyed. Callers must ensure that the underlying k8s environment has been deleted prior to calling this, otherwise potentially orphan k8s resources will be left running.
func (*PGLayer) GetEventLogByID ¶
GetEventLogByID returns a single EventLog by id, or nil or error
func (*PGLayer) GetEventLogsByEnvName ¶
GetEventLogsByEnvName gets all EventLogs associated with an environment
func (*PGLayer) GetEventLogsByRepoAndPR ¶
GetEventLogsByRepoAndPR gets all EventLogs associated with a repo and PR, sorted in reverse created order (newest first)
func (*PGLayer) GetExtantQAEnvironments ¶
func (p *PGLayer) GetExtantQAEnvironments(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
GetExtantQAEnvironments finds any environments for the given repo/PR combination that are not status Destroyed
func (*PGLayer) GetHelmReleasesForEnv ¶
func (*PGLayer) GetK8sEnv ¶
func (pg *PGLayer) GetK8sEnv(ctx context.Context, name string) (*models.KubernetesEnvironment, error)
GetK8sEnv gets a k8s environment by environment name
func (*PGLayer) GetK8sEnvsByNamespace ¶
func (pg *PGLayer) GetK8sEnvsByNamespace(ctx context.Context, ns string) ([]models.KubernetesEnvironment, error)
GetK8sEnvsByNamespace returns any KubernetesEnvironments associated with a specific namespace name
func (*PGLayer) GetMostRecent ¶
GetMostRecent finds the most recent environments from the last n days. Recency is defined by created/updated timestamps. The returned slice is in descending order of recency.
func (*PGLayer) GetQAEnvironment ¶
GetQAEnvironment finds a QAEnvironment by the name field.
func (*PGLayer) GetQAEnvironmentBySourceSHA ¶
func (p *PGLayer) GetQAEnvironmentBySourceSHA(ctx context.Context, sourceSHA string) (*QAEnvironment, error)
GetQAEnvironmentBySourceSHA returns an environment with a matching sourceSHA.
func (*PGLayer) GetQAEnvironmentConsistently ¶
func (p *PGLayer) GetQAEnvironmentConsistently(ctx context.Context, name string) (*QAEnvironment, error)
GetQAEnvironmentConsistently finds a QAEnvironment by the name field consistently.
func (*PGLayer) GetQAEnvironments ¶
func (p *PGLayer) GetQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
GetQAEnvironments returns all QA records
func (*PGLayer) GetQAEnvironmentsByRepo ¶
func (p *PGLayer) GetQAEnvironmentsByRepo(ctx context.Context, repo string) ([]QAEnvironment, error)
GetQAEnvironmentsByRepo returns all environments which have matching repo.
func (*PGLayer) GetQAEnvironmentsByRepoAndPR ¶
func (p *PGLayer) GetQAEnvironmentsByRepoAndPR(ctx context.Context, repo string, pr uint) ([]QAEnvironment, error)
GetQAEnvironmentsByRepoAndPR teturns all environments which have matching repo AND pull request.
func (*PGLayer) GetQAEnvironmentsBySourceBranch ¶
func (p *PGLayer) GetQAEnvironmentsBySourceBranch(ctx context.Context, sourceBranch string) ([]QAEnvironment, error)
GetQAEnvironmentsBySourceBranch returns all environments which have matching sourceBranch.
func (*PGLayer) GetQAEnvironmentsByStatus ¶
func (p *PGLayer) GetQAEnvironmentsByStatus(ctx context.Context, status string) ([]QAEnvironment, error)
GetQAEnvironmentsByStatus gets all environmens matching status. TODO(geoffrey): Revisit raw_status with @benjamen
func (*PGLayer) GetQAEnvironmentsByUser ¶
func (p *PGLayer) GetQAEnvironmentsByUser(ctx context.Context, user string) ([]QAEnvironment, error)
GetQAEnvironmentsByUser retrieve all QAEnvironment by user (User is username in the DB see models/models.go).
func (*PGLayer) GetRunningQAEnvironments ¶
func (p *PGLayer) GetRunningQAEnvironments(ctx context.Context) ([]QAEnvironment, error)
GetRunningQAEnvironments returns all environments with status "success", "updating" or "spawned", in ascending order of creation time.
func (*PGLayer) Search ¶
func (p *PGLayer) Search(ctx context.Context, opts models.EnvSearchParameters) ([]QAEnvironment, error)
Search finds environments that satsify the parameters given. Multiple parameters are combined with implicit AND.
func (*PGLayer) SetAminoEnvironmentID ¶
SetAminoEnvironmentID sets the Amino environment ID for an environment.
func (*PGLayer) SetAminoKubernetesNamespace ¶
func (p *PGLayer) SetAminoKubernetesNamespace(ctx context.Context, name string, namespace string) error
SetAminoKubernetesNamespace sets the Kubernetes namespace for an environment.
func (*PGLayer) SetAminoServiceToPort ¶
func (p *PGLayer) SetAminoServiceToPort(ctx context.Context, name string, serviceToPort map[string]int64) error
SetAminoServiceToPort sets the Amino service port metadata for an environment.
func (*PGLayer) SetEventLogEnvName ¶
SetEventLogEnvName sets the env name for an EventLog
func (*PGLayer) SetQAEnvironmentCommitSHAMap ¶
func (p *PGLayer) SetQAEnvironmentCommitSHAMap(ctx context.Context, name string, commitSHAMap RefMap) error
SetQAEnvironmentCommitSHAMap sets a specific QAEnvironment's commitSHAMap.
func (*PGLayer) SetQAEnvironmentCreated ¶
func (p *PGLayer) SetQAEnvironmentCreated(ctx context.Context, name string, created time.Time) error
SetQAEnvironmentCreated sets a specific QAEnvironment's created time.
func (*PGLayer) SetQAEnvironmentRefMap ¶
SetQAEnvironmentRefMap sets a specific QAEnvironment's RefMap.
func (*PGLayer) SetQAEnvironmentRepoData ¶
func (p *PGLayer) SetQAEnvironmentRepoData(ctx context.Context, name string, repo *RepoRevisionData) error
SetQAEnvironmentRepoData sets a specific QAEnvironment's RepoRevisionData.
func (*PGLayer) SetQAEnvironmentStatus ¶
func (p *PGLayer) SetQAEnvironmentStatus(ctx context.Context, name string, status EnvironmentStatus) error
SetQAEnvironmentStatus sets a specific QAEnvironment's status. Note that this will bail if the context was canceled. It is often recommended to pass a fresh context to this function.
func (*PGLayer) UpdateHelmReleaseRevision ¶
type QADestroyReason ¶
type QADestroyReason = models.QADestroyReason
type QAEnvironment ¶
type QAEnvironment = models.QAEnvironment
type QAEnvironmentEvent ¶
type QAEnvironmentEvent = models.QAEnvironmentEvent
type QAEnvironments ¶
type QAEnvironments = models.QAEnvironments
type RepoRevisionData ¶
type RepoRevisionData = models.RepoRevisionData
type ServerConfig ¶
type ServerConfig = config.ServerConfig