Documentation
¶
Index ¶
- func AggregatedDigestEmailJob[T logging.ChainableErrorOrWarnLogger[T]](dateAnalyzed time.Time, store *storage.Store, logger T, ...) error
- func CreateModelStatusJobInBatch[T logging.ChainableErrorOrWarnLogger[T]](logger T, w *Worker, batch *faktory.Batch, plan *models.ModelPlan) error
- func CreateModelStatusUpdateBatch[T logging.ChainableErrorOrWarnLogger[T]](logger T, w *Worker, cl *faktory.Client, modelPlans []*models.ModelPlan) error
- func CreateTranslatedAuditBatch[T logging.ChainableErrorOrWarnLogger[T]](w *Worker, logger T, cl *faktory.Client, ...) error
- func FaktoryLoggerMiddleware() faktory_worker.MiddlewareFunc
- func JobWithPanicProtection(jobFunc faktory_worker.Perform) faktory_worker.Perform
- func NewDBConfig() storage.DBConfig
- func QueueTranslatedAuditJob[T logging.ChainableErrorOrWarnLogger[T]](w *Worker, logger T, batch *faktory.Batch, ...) (*models.TranslatedAuditQueue, error)
- func RecoverFaktoryJobPanicAndLogError(ctx context.Context, returnedError *error)
- type FaktoryLogger
- func (l *FaktoryLogger) DecorateWithJobInfo() *FaktoryLogger
- func (l *FaktoryLogger) ErrorOrWarn(msg string, fields ...zap.Field)
- func (l *FaktoryLogger) IsFinalAttempt() bool
- func (l *FaktoryLogger) Named(s string) *FaktoryLogger
- func (l *FaktoryLogger) ShouldError() bool
- func (l *FaktoryLogger) With(fields ...zap.Field) *FaktoryLogger
- func (l *FaktoryLogger) WithOptions(opts ...zap.Option) *FaktoryLogger
- type JobWrapper
- type TestConfigs
- type Worker
- func (w *Worker) AggregatedDigestEmailJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) AnalyzedAuditBatchJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) AnalyzedAuditBatchJobSuccess(ctx context.Context, args ...interface{}) error
- func (w *Worker) AnalyzedAuditJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) DigestCronJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) DigestEmailBatchJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) DigestEmailBatchJobSuccess(ctx context.Context, args ...interface{}) error
- func (w *Worker) DigestEmailJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) ModelStatusUpdateBatchJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) ModelStatusUpdateBatchJobSuccess(ctx context.Context, args ...interface{}) error
- func (w *Worker) ModelStatusUpdateCronJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) ModelStatusUpdateJob(ctx context.Context, args ...interface{}) (returnedError error)
- func (w *Worker) RefreshOktaCronJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) TranslateAuditBatchJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) TranslateAuditBatchJobSuccess(ctx context.Context, args ...interface{}) error
- func (w *Worker) TranslateAuditCronJob(ctx context.Context, args ...interface{}) error
- func (w *Worker) TranslateAuditJob(ctx context.Context, args ...interface{}) (returnedError error)
- func (w *Worker) Work()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregatedDigestEmailJob ¶
func AggregatedDigestEmailJob[T logging.ChainableErrorOrWarnLogger[T]]( dateAnalyzed time.Time, store *storage.Store, logger T, emailService oddmail.EmailService, addressBook email.AddressBook, ) error
AggregatedDigestEmailJob is the handler for the AggregatedDigestEmailJob which sends a daily digest email containing all analyzed audits from the audit period
func CreateTranslatedAuditBatch ¶
func CreateTranslatedAuditBatch[T logging.ChainableErrorOrWarnLogger[T]](w *Worker, logger T, cl *faktory.Client, queueObjects []*models.TranslatedAuditQueue) error
CreateTranslatedAuditBatch Creates a new batch job using the provided faktory client it will create a translated audit job for each provided queueObject
func FaktoryLoggerMiddleware ¶
func FaktoryLoggerMiddleware() faktory_worker.MiddlewareFunc
FaktoryLoggerMiddleware is a Faktory middleware that adds a FaktoryLogger to the context with standard Faktory fields
func JobWithPanicProtection ¶
func JobWithPanicProtection(jobFunc faktory_worker.Perform) faktory_worker.Perform
JobWithPanicProtection wraps a faktory Job in a wrapper function that will return an error instead of stopping the application.
func NewDBConfig ¶
NewDBConfig returns a DBConfig struct with values from appconfig
func QueueTranslatedAuditJob ¶
func QueueTranslatedAuditJob[T logging.ChainableErrorOrWarnLogger[T]](w *Worker, logger T, batch *faktory.Batch, queueObj *models.TranslatedAuditQueue) (*models.TranslatedAuditQueue, error)
QueueTranslatedAuditJob takes a given queueObj and creates a job as part of the provided batch
Types ¶
type FaktoryLogger ¶
func FaktoryLoggerFromContext ¶
func FaktoryLoggerFromContext(ctx context.Context) *FaktoryLogger
FaktoryLoggerFromContext retrieves the FaktoryLogger from the context, or creates a new one if not present
func NewFaktoryLogger ¶
func NewFaktoryLogger(logger *zap.Logger) *FaktoryLogger
NewFaktoryLogger creates a new FaktoryLogger from a zap.Logger
func (*FaktoryLogger) DecorateWithJobInfo ¶
func (l *FaktoryLogger) DecorateWithJobInfo() *FaktoryLogger
DecorateWithJobInfo adds faktory job info fields to the logger Its intended to be used in the initial wrapper stage
func (*FaktoryLogger) ErrorOrWarn ¶
func (l *FaktoryLogger) ErrorOrWarn(msg string, fields ...zap.Field)
func (*FaktoryLogger) IsFinalAttempt ¶
func (l *FaktoryLogger) IsFinalAttempt() bool
func (*FaktoryLogger) Named ¶
func (l *FaktoryLogger) Named(s string) *FaktoryLogger
func (*FaktoryLogger) ShouldError ¶
func (l *FaktoryLogger) ShouldError() bool
ShouldError returns true if the job is on its final attempt if not, it returns false
func (*FaktoryLogger) With ¶
func (l *FaktoryLogger) With(fields ...zap.Field) *FaktoryLogger
func (*FaktoryLogger) WithOptions ¶
func (l *FaktoryLogger) WithOptions(opts ...zap.Option) *FaktoryLogger
type JobWrapper ¶
type TestConfigs ¶
type TestConfigs struct {
DBConfig storage.DBConfig
LDClient *ld.LDClient
Logger *zap.Logger
UserInfo *models.UserInfo
Store *storage.Store
S3Client *s3.S3Client
PubSub *pubsub.ServicePubSub
Principal *authentication.ApplicationPrincipal
Context context.Context
OktaClient oktaapi.Client
}
TestConfigs is a struct that contains all the dependencies needed to run a test
func GetDefaultTestConfigs ¶
func GetDefaultTestConfigs() *TestConfigs
GetDefaultTestConfigs returns a TestConfigs struct with all the dependencies needed to run a test
func (*TestConfigs) GetDefaults ¶
func (tc *TestConfigs) GetDefaults()
GetDefaults sets the dependencies for the TestConfigs struct that will remain constant across the suite The principal needs to be set before every test as the user account is removed between tests
type Worker ¶
type Worker struct {
Store *storage.Store
Environment appconfig.Environment
EmailService oddmail.EmailService
AddressBook email.AddressBook
Connections int
ProcessJobs bool
OktaAPIClient oktaapi.Client
}
Worker is a struct that contains all the dependencies to run worker functions
func (*Worker) AggregatedDigestEmailJob ¶
AggregatedDigestEmailJob will generate and send an email based on all models changed in the audit period
func (*Worker) AnalyzedAuditBatchJob ¶
AnalyzedAuditBatchJob batches all the daily AnalyzedAuditJobs. When all are complete it will fire a callback args[0] date
func (*Worker) AnalyzedAuditBatchJobSuccess ¶
AnalyzedAuditBatchJobSuccess is the callback function for AnalyzedAuditBatchJob args[0] date
func (*Worker) AnalyzedAuditJob ¶
AnalyzedAuditJob analyzes the given model and model relations on the specified date args[0] date, args[1] modelPlanID
func (*Worker) DigestCronJob ¶
DigestCronJob is the job the cron schedule calls
func (*Worker) DigestEmailBatchJob ¶
DigestEmailBatchJob is the batch job for DigestEmailJobs args[0] date
func (*Worker) DigestEmailBatchJobSuccess ¶
DigestEmailBatchJobSuccess is the callback function forDigestEmailBatchJob args[0] date
func (*Worker) DigestEmailJob ¶
DigestEmailJob will generate and send an email based on a users favorited Models. args[0] date, args[1] userID
func (*Worker) ModelStatusUpdateBatchJob ¶
ModelStatusUpdateBatchJob is the job the cron job initiates to check if models need a status update. It will batch all child jobs, and when complete it will fire a callback
func (*Worker) ModelStatusUpdateBatchJobSuccess ¶
ModelStatusUpdateBatchJobSuccess is called when the model status update job has completed.
func (*Worker) ModelStatusUpdateCronJob ¶
ModelStatusUpdateCronJob is the job the cron schedule calls to check if models
func (*Worker) ModelStatusUpdateJob ¶
func (w *Worker) ModelStatusUpdateJob(ctx context.Context, args ...interface{}) (returnedError error)
ModelStatusUpdateJob is the job to check if a model should be updated, and if so, it will send an email args[0] model_plan_id (UUID)
func (*Worker) RefreshOktaCronJob ¶
RefreshOktaCronJob is the job the cron schedule to refresh okta token every 15 days
func (*Worker) TranslateAuditBatchJob ¶
TranslateAuditBatchJob batches all the TranslateAuditJobs. When all are complete it will fire a callback args are not currently being used.
func (*Worker) TranslateAuditBatchJobSuccess ¶
TranslateAuditBatchJobSuccess is the call back that gets called when the TranslatedAuditBatchJob Completes
func (*Worker) TranslateAuditCronJob ¶
TranslateAuditCronJob is the job the cron schedule calls
func (*Worker) TranslateAuditJob ¶
TranslateAuditJob is the job to translate an individual audit into an analyzed audit, and note that the translation is done in the processing table args[0] the id of the audit change (int, but float in faktory) args[0] the id of the queue (UUID)
Source Files
¶
- aggregated_digest_email_job.go
- analyzed_audit_job.go
- digest_cron_job.go
- digest_email_job.go
- faktory_logger.go
- job_utilities.go
- model_status_update_batch_job.go
- model_status_update_cron_job.go
- model_status_update_job.go
- okta_cron_job.go
- translate_audit_batch_job.go
- translate_audit_cron_job.go
- translate_audit_job.go
- worker.go
- worker_test_utilities.go