Files
threshold/internal/recording/recording.go
T
429247f407 [COMPLIANCE] Update Copyright Headers (#6282)
* [COMPLIANCE] Update Copyright and License Headers

* chore: make gen to generate files with copyright headers

* chore: update missed copyright headers

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
2026-01-28 11:05:07 -06:00

47 lines
1.3 KiB
Go

// Copyright IBM Corp. 2020, 2025
// SPDX-License-Identifier: BUSL-1.1
package recording
import (
"context"
"fmt"
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/errors"
"github.com/hashicorp/boundary/internal/globals"
"github.com/hashicorp/boundary/internal/kms"
"github.com/hashicorp/boundary/internal/scheduler"
)
// RegisterJob registers the delete session recording job with the provided scheduler.
func RegisterJob(ctx context.Context,
s *scheduler.Scheduler,
r db.Reader,
w db.Writer,
controllerExt globals.ControllerExtension,
kms kms.GetWrapperer,
) error {
const op = "storage.RegisterJob"
switch {
case s == nil:
return errors.New(ctx, errors.InvalidParameter, op, "missing scheduler")
case r == nil:
return errors.New(ctx, errors.InvalidParameter, op, "missing db.Reader")
case w == nil:
return errors.New(ctx, errors.InvalidParameter, op, "missing db.Writer")
case kms == nil:
return errors.New(ctx, errors.InvalidParameter, op, "missing kms")
}
dsrJob, err := NewDeleteSessionRecordingJobFn(ctx, r, w, controllerExt, kms)
if err != nil {
return fmt.Errorf("error creating delete session recording job: %w", err)
}
if err := s.RegisterJob(ctx, dsrJob); err != nil {
return errors.Wrap(ctx, err, op)
}
return nil
}