database

package
v0.0.0-...-c7bad6d Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppService

type AppService struct {
	App       string
	Ingress   string
	Slug      string
	Namespace string
}

type EventStatus

type EventStatus string
const (
	EventStatusNew             EventStatus = "new"
	EventStatusProcessing      EventStatus = "processing"
	EventStatusCompleted       EventStatus = "completed"
	EventStatusPending         EventStatus = "pending"
	EventStatusFailed          EventStatus = "failed"
	EventStatusManualFailed    EventStatus = "manual_failed"
	EventStatusDeadlineReached EventStatus = "deadline_reached"
)

type EventType

type EventType string
const (
	EventTypeCreateTeam           EventType = "create:team"
	EventTypeUpdateTeam           EventType = "update:team"
	EventTypeDeleteTeam           EventType = "delete:team"
	EventTypeCreateJupyter        EventType = "create:jupyter"
	EventTypeUpdateJupyter        EventType = "update:jupyter"
	EventTypeDeleteJupyter        EventType = "delete:jupyter"
	EventTypeCreateAirflow        EventType = "create:airflow"
	EventTypeUpdateAirflow        EventType = "update:airflow"
	EventTypeDeleteAirflow        EventType = "delete:airflow"
	EventTypeCreateCompute        EventType = "create:compute"
	EventTypeResizeCompute        EventType = "resize:compute"
	EventTypeDeleteCompute        EventType = "delete:compute"
	EventTypeCreateUserGSM        EventType = "create:usergsm"
	EventTypeDeleteUserGSM        EventType = "delete:usergsm"
	EventTypeHelmRolloutJupyter   EventType = "rolloutJupyter:helm"
	EventTypeHelmRollbackJupyter  EventType = "rollbackJupyter:helm"
	EventTypeHelmUninstallJupyter EventType = "uninstallJupyter:helm"
	EventTypeHelmRolloutAirflow   EventType = "rolloutAirflow:helm"
	EventTypeHelmRollbackAirflow  EventType = "rollbackAirflow:helm"
	EventTypeHelmUninstallAirflow EventType = "uninstallAirflow:helm"
)

type EventWithLogs

type EventWithLogs struct {
	gensql.Event
	Payload string
	Logs    []gensql.EventLog
}

type LogType

type LogType string
const (
	LogTypeInfo  LogType = "info"
	LogTypeError LogType = "error"
)

type Querier

type Querier interface {
	gensql.Querier
	WithTx(tx *sql.Tx) *gensql.Queries
}

type Repo

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

func New

func New(dbConnDSN, cryptoKey string, log *logrus.Entry) (*Repo, error)

func (*Repo) ChartDelete

func (r *Repo) ChartDelete(ctx context.Context, teamID string, chartType gensql.ChartType) error

func (*Repo) ChartsForTeamGet

func (r *Repo) ChartsForTeamGet(ctx context.Context, teamID string) ([]gensql.ChartType, error)

func (*Repo) ComputeInstanceCreate

func (r *Repo) ComputeInstanceCreate(ctx context.Context, instance *gensql.ComputeInstance) error

func (*Repo) ComputeInstanceDelete

func (r *Repo) ComputeInstanceDelete(ctx context.Context, owner string) error

func (*Repo) ComputeInstanceGet

func (r *Repo) ComputeInstanceGet(ctx context.Context, owner string) (gensql.ComputeInstance, error)

func (*Repo) ComputeInstanceUpdate

func (r *Repo) ComputeInstanceUpdate(ctx context.Context, owner string, diskSize int32) error

func (*Repo) ComputeInstancesGet

func (r *Repo) ComputeInstancesGet(ctx context.Context) ([]gensql.ComputeInstance, error)

func (*Repo) DecryptValue

func (r *Repo) DecryptValue(encValue string) (string, error)

func (*Repo) DispatchableEventsGet

func (r *Repo) DispatchableEventsGet(ctx context.Context) ([]gensql.Event, error)

func (*Repo) EncryptValue

func (r *Repo) EncryptValue(encValue string) (string, error)

func (*Repo) EventGet

func (r *Repo) EventGet(ctx context.Context, id uuid.UUID) (gensql.Event, error)

func (*Repo) EventIncrementRetryCount

func (r *Repo) EventIncrementRetryCount(ctx context.Context, id uuid.UUID) error

func (*Repo) EventLogCreate

func (r *Repo) EventLogCreate(ctx context.Context, id uuid.UUID, message string, logType LogType) error

func (*Repo) EventLogsForEventGet

func (r *Repo) EventLogsForEventGet(ctx context.Context, id uuid.UUID) ([]gensql.EventLog, error)

func (*Repo) EventLogsForOwnerGet

func (r *Repo) EventLogsForOwnerGet(ctx context.Context, owner string, limit int32) ([]EventWithLogs, error)

func (*Repo) EventSetStatus

func (r *Repo) EventSetStatus(ctx context.Context, id uuid.UUID, status EventStatus) error

func (*Repo) EventsByOwnerGet

func (r *Repo) EventsByOwnerGet(ctx context.Context, teamID string, limit int32) ([]gensql.Event, error)

func (*Repo) EventsGetType

func (r *Repo) EventsGetType(ctx context.Context, eventType EventType) ([]gensql.Event, error)

func (*Repo) EventsReset

func (r *Repo) EventsReset(ctx context.Context) error

func (*Repo) GlobalChartValueInsert

func (r *Repo) GlobalChartValueInsert(ctx context.Context, key, value string, encrypted bool, chartType gensql.ChartType) error

func (*Repo) GlobalValueDelete

func (r *Repo) GlobalValueDelete(ctx context.Context, key string, chartType gensql.ChartType) error

func (*Repo) GlobalValueGet

func (r *Repo) GlobalValueGet(ctx context.Context, chartType gensql.ChartType, key string) (gensql.ChartGlobalValue, error)

func (*Repo) GlobalValuesGet

func (r *Repo) GlobalValuesGet(ctx context.Context, chartType gensql.ChartType) ([]gensql.ChartGlobalValue, error)

func (*Repo) HelmChartValuesInsert

func (r *Repo) HelmChartValuesInsert(ctx context.Context, chartType gensql.ChartType, chartValues map[string]string, teamID string) error

func (*Repo) NewSessionStore

func (r *Repo) NewSessionStore(key string) (gin.HandlerFunc, error)

func (*Repo) RegisterCreateAirflowEvent

func (r *Repo) RegisterCreateAirflowEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterCreateComputeEvent

func (r *Repo) RegisterCreateComputeEvent(ctx context.Context, owner string, values any) error

func (*Repo) RegisterCreateJupyterEvent

func (r *Repo) RegisterCreateJupyterEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterCreateTeamEvent

func (r *Repo) RegisterCreateTeamEvent(ctx context.Context, team gensql.Team) error

func (*Repo) RegisterCreateUserGSMEvent

func (r *Repo) RegisterCreateUserGSMEvent(ctx context.Context, owner string, values any) error

func (*Repo) RegisterDeleteAirflowEvent

func (r *Repo) RegisterDeleteAirflowEvent(ctx context.Context, teamID string) error

func (*Repo) RegisterDeleteComputeEvent

func (r *Repo) RegisterDeleteComputeEvent(ctx context.Context, email string) error

func (*Repo) RegisterDeleteJupyterEvent

func (r *Repo) RegisterDeleteJupyterEvent(ctx context.Context, teamID string) error

func (*Repo) RegisterDeleteTeamEvent

func (r *Repo) RegisterDeleteTeamEvent(ctx context.Context, teamID string) error

func (*Repo) RegisterDeleteUserGSMEvent

func (r *Repo) RegisterDeleteUserGSMEvent(ctx context.Context, owner string) error

func (*Repo) RegisterHelmRollbackAirflowEvent

func (r *Repo) RegisterHelmRollbackAirflowEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterHelmRollbackJupyterEvent

func (r *Repo) RegisterHelmRollbackJupyterEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterHelmRolloutAirflowEvent

func (r *Repo) RegisterHelmRolloutAirflowEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterHelmRolloutJupyterEvent

func (r *Repo) RegisterHelmRolloutJupyterEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterHelmUninstallAirflowEvent

func (r *Repo) RegisterHelmUninstallAirflowEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterHelmUninstallJupyterEvent

func (r *Repo) RegisterHelmUninstallJupyterEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterResizeComputeDiskEvent

func (r *Repo) RegisterResizeComputeDiskEvent(ctx context.Context, owner string, values any) error

func (*Repo) RegisterUpdateAirflowEvent

func (r *Repo) RegisterUpdateAirflowEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterUpdateJupyterEvent

func (r *Repo) RegisterUpdateJupyterEvent(ctx context.Context, teamID string, values any) error

func (*Repo) RegisterUpdateTeamEvent

func (r *Repo) RegisterUpdateTeamEvent(ctx context.Context, team gensql.Team) error

func (*Repo) ServicesForUser

func (r *Repo) ServicesForUser(ctx context.Context, email, topLevelDomain string) (UserServices, error)

func (*Repo) SessionCreate

func (r *Repo) SessionCreate(ctx context.Context, session *auth.Session) error

func (*Repo) SessionDelete

func (r *Repo) SessionDelete(ctx context.Context, token string) error

func (*Repo) SessionGet

func (r *Repo) SessionGet(ctx context.Context, token string) (*auth.Session, error)

func (*Repo) TeamBySlugGet

func (r *Repo) TeamBySlugGet(ctx context.Context, slug string) (gensql.TeamBySlugGetRow, error)

func (*Repo) TeamChartValueInsert

func (r *Repo) TeamChartValueInsert(ctx context.Context, key, value, teamID string, chartType gensql.ChartType) error

func (*Repo) TeamConfigurableValuesGet

func (r *Repo) TeamConfigurableValuesGet(ctx context.Context, chartType gensql.ChartType, teamID string, obj any) error

func (*Repo) TeamCreate

func (r *Repo) TeamCreate(ctx context.Context, team *gensql.Team) error

func (*Repo) TeamDelete

func (r *Repo) TeamDelete(ctx context.Context, teamID string) error

func (*Repo) TeamGet

func (r *Repo) TeamGet(ctx context.Context, teamID string) (gensql.TeamGetRow, error)

func (*Repo) TeamUpdate

func (r *Repo) TeamUpdate(ctx context.Context, team *gensql.Team) error

func (*Repo) TeamValueDelete

func (r *Repo) TeamValueDelete(ctx context.Context, key, teamID string) error

func (*Repo) TeamValueGet

func (r *Repo) TeamValueGet(ctx context.Context, key, teamID string) (gensql.ChartTeamValue, error)

func (*Repo) TeamValueInsert

func (r *Repo) TeamValueInsert(ctx context.Context, chartType gensql.ChartType, key, value, teamID string) error

func (*Repo) TeamValuesGet

func (r *Repo) TeamValuesGet(ctx context.Context, chartType gensql.ChartType, teamID string) ([]gensql.ChartTeamValue, error)

func (*Repo) TeamsForChartGet

func (r *Repo) TeamsForChartGet(ctx context.Context, chartType gensql.ChartType) ([]string, error)

func (*Repo) TeamsForUser

func (r *Repo) TeamsForUser(ctx context.Context, email string) ([]string, error)

func (*Repo) TeamsGet

func (r *Repo) TeamsGet(ctx context.Context) ([]gensql.Team, error)

func (*Repo) UserGSMCreate

func (r *Repo) UserGSMCreate(ctx context.Context, googleSecretManager *gensql.UserGoogleSecretManager) error

func (*Repo) UserGSMDelete

func (r *Repo) UserGSMDelete(ctx context.Context, owner string) error

func (*Repo) UserGSMGet

func (r *Repo) UserGSMGet(ctx context.Context, owner string) (gensql.UserGoogleSecretManager, error)

type RepoMock

type RepoMock struct{}

func (*RepoMock) DispatchableEventsGet

func (r *RepoMock) DispatchableEventsGet(ctx context.Context) ([]gensql.Event, error)

func (*RepoMock) DispatcherEventsGet

func (r *RepoMock) DispatcherEventsGet(ctx context.Context) ([]gensql.Event, error)

func (*RepoMock) EventIncrementRetryCount

func (r *RepoMock) EventIncrementRetryCount(ctx context.Context, id uuid.UUID) error

func (*RepoMock) EventLogCreate

func (r *RepoMock) EventLogCreate(ctx context.Context, id uuid.UUID, message string, logType LogType) error

func (*RepoMock) EventSetStatus

func (r *RepoMock) EventSetStatus(ctx context.Context, id uuid.UUID, status EventStatus) error

func (*RepoMock) EventsReset

func (r *RepoMock) EventsReset(ctx context.Context) error

func (*RepoMock) RegisterHelmInstallOrUpgradeEvent

func (r *RepoMock) RegisterHelmInstallOrUpgradeEvent(ctx context.Context, teamID string, helmEvent any) error

func (*RepoMock) RegisterHelmRollbackEvent

func (r *RepoMock) RegisterHelmRollbackEvent(ctx context.Context, helmEvent any) error

func (*RepoMock) RegisterHelmUninstallEvent

func (r *RepoMock) RegisterHelmUninstallEvent(ctx context.Context, helmEvent any) bool

type Repository

type Repository interface {
	EventSetStatus(context.Context, uuid.UUID, EventStatus) error
	EventIncrementRetryCount(context.Context, uuid.UUID) error
	DispatchableEventsGet(context.Context) ([]gensql.Event, error)
	EventsReset(context.Context) error
	EventLogCreate(context.Context, uuid.UUID, string, LogType) error
}

type TeamServices

type TeamServices struct {
	TeamID     string
	Slug       string
	Jupyterhub *AppService
	Airflow    *AppService
	Events     []EventWithLogs
}

type UserServices

type UserServices struct {
	Services   []TeamServices
	Compute    *gensql.ComputeInstance
	UserGSM    *gensql.UserGoogleSecretManager
	UserEvents []EventWithLogs
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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